[Home] [By Thread] [By Date] [Recent Entries]
cknell@xxxxxxxxxx wrote:
Thanks. I eventually figured out what I needed. I made the match alternatives more explicit and refreshed my memory on the grouping and alternation symbols, and I got something that worked for me. If fewer characters is what you are after, than you can make it still a bit shorter by doing this ^(0[1-9]|1[0-2])/([0-2]\d|3[01])/(200[5-7]) You seem to be missing the $ anchor matching the end of the string. Do you not want to match the whole string? Note that your match matches: 01/01/2006something Also, I happen to have a regex that takes months being 28, 30 or 31 days into account, however I stopped trying to find out the leap years regexes as these are a bit harder (and calculation is easier). Doesn't this already sound awefully obfuscated?
Good ol' Jeffrey Friedl called it an art. And isn't an art supposed to be given regular practice? ;)
Same here, I did it from 1998. I have a dear friend that is still a hardcore Perl programmer. I have loved the language (still do) for its brevity and speed. And of course, it gave regular expressions a whole new face (or dare I say era?) Cheers, -- Abel Braaksma http://www.nuntia.nl
|

Cart



