My name is Edward Tanguay. I'm an American software and web developer living and working in Berlin, Germany.
2 days ago: Oh great, another "it depends" answer, isn't anything simple anymore? http://t.co/ypAZDhvX.
3 days ago: 24K sunday training: three cold 5Ks 24:14, 26:48, 29:13, 61 days to #parismarathon: http://t.co/pRWmrVui.
3 days ago: 5th grade humor: "your arithmetic is terrible, where did you learn math? / yale / yale? what's your name? / yim yonson".
5 days ago: News in slow french: nice way to keep your french up to par: audio, transcription, hover-vocabulary: http://t.co/ykqztLlM.
5 days ago: Newsinslowenglish: nice way to improve English: audio, transcription, hover-vocabulary #tesl #esl #efl: http://t.co/ehq08wQD.
5 days ago: Overheard at home: "I like my sister 23%".
5 days ago: This is the way I used to teach German pronunciation in college, fun memories: http://t.co/eRULGfun.
5 days ago: "excuse me, but, um, your location is leaking".
5 days ago: "our vision for photography in berlin is for it to be lively, progressive and active" #berlin #photography @just4you http://t.co/0I59GQeV.
5 days ago: Facebook will eventually find a way to stamp out privacy: "everyone famous to their friends & therefore public figures" http://t.co/p4V9RLSA.
5 days ago: .@nickhoward there's a global layer of educational incompetence surfacing everywhere where people want to teach instead of help people learn.
C# CODE EXAMPLE created on Saturday, February 06, 2010 permalink
Base code to create a simple regex unit tester
Here's some base code I use when I've written a regex and need to test it with positive and negative cases as I tweak it.
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;

namespace Testreg2342
{
    public class Program
    {
        static void Main(string[] args)
        {
            bool unitTestPassed = true;

            List<string> goodEntries = new List<string>
            {
                "2008-12-22"
            };

            List<string> badEntries = new List<string>
            {
                "2010-12-12X",
                "2010-12-32 12:00:00"
            };

            foreach (var entry in goodEntries)
            {
                if (entry.IsValidDateFormat())
                    Console.WriteLine("ok: good entry correctly passed: " + entry);
                else
                {
                    Console.WriteLine("**FAIL** GOOD ENTRY INCORRECTLY DID NOT PASS: " + entry);
                    unitTestPassed = false;
                }
            }

            foreach (var entry in badEntries)
            {
                if (!entry.IsValidDateFormat())
                    Console.WriteLine("ok: bad entry corrcectly did not pass : " + entry);
                else
                {
                    Console.WriteLine("**FAIL** BAD ENTRY INCORRECTLY PASSED: " + entry);
                    unitTestPassed = false;
                }
            }

            Console.WriteLine();
            if(unitTestPassed)
                Console.WriteLine("unit test passed");
            else
                Console.WriteLine("UNIT TEST FAILED, CORRECT ALL ENTRIES MARKED **FAIL** ABOVE!");

            Console.ReadLine();

        }
    }

    public static class StringHelpers
    {
        public static bool IsValidDateFormat(this string purportedDateFormat)
        {
            return RegexHelpers.Matches(purportedDateFormat, @"^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$");
        }
    }

    public static class RegexHelpers
    {

        //use if you are expecting only one match, e.g. from "id = ???"
        public static string GetMatch(string text, string regex)
        {
            Match match = Regex.Match(text, regex);
            if (match.Success)
            {
                string theMatch = match.Groups[0].Value;
                return theMatch;
            }
            else
            {
                return null;
            }
        }

        public static bool Matches(string text, string regex)
        {
            if (GetMatch(text, regex) != null)
                return true;
            else
                return false;
        }
    }
}
need markup?