I regularly use the
Regular Expression Library[
^] to help find and validate REGEX.
That said, I think it's a good thing to learn how these things work for yourself. MS has some really good references for using REGEX with C#:
Regular Expression Language - Quick Reference[
^]
In your case, you want a month and year. We could use the regex to extract them from a string and use a post-submit validator, but it looks like you want a pre-submit so we'll keep it easy.
"^[a-zA-Z]+\s{1}[0-9]{4}$"
This simple validator will simply evaluate that a word is followed by a space is followed by a 4-digit number. Here's the breakdown:
^ Start evalation at the first character of the string.
[a-zA-Z]+ match alphabetic characters, lower and upper case, one or more times.
\s{1} match whitespace exactly once.
[0-9]{4} match a numeric digit exactly 4 times
$ match the string terminator
You can do a hell of a lot more with REGEX should you so choose. It's a superbly useful tool that gets ignored too often due to the oblique syntax.