regex - PHP Dynamic Regular expression? -


I'm relativly new to regular expression, but I managed to create a work expression to validate the dates (without Leap year, and people who register 30 or 31 points valid for one month.)

This is expressed: / ^ \ d [1-31] ​​{2} \ \ D [1-12] {2} \ - \ d [1900-2009] {4} $ /

But I would like a dynamic regular expression such as:

  $ yearspan = (date ("Y") - 110) "-". Date ("Y"); / ^ \ D [1-31] ​​{2} \ - \ d [1-12] {2} \ - \ d [$ yearSpan] {4} $ /  

When I try to use this expression, I keep telling me that the compilation has failed because there is a range of sequence in the character range.

I am using this expression to validate the date of birth, and it would be good not to update it every year a year.

Any suggestions?

You can do this with the PHP date and time functions

< / Html>

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -