tags:

views:

89

answers:

1

I have a Drupal module which allow regex check of a text field. To check a valid birth year of 4+ years old, the valid range is year 1900 to 2006.

So assume the input string must be 4-char long. What's the regex to check the string is in that range? Thanks!

+3  A: 

This should do the trick:

"^(19[0-9]{2}|200[0-6])$"
ck