I’m very new in regular expression and I’m trying to validate date using following regular expression here:
^[1-31]\.[1-12]\.[1999-2005]$
but I’m getting an output as “invalid reguar expression”
Could anyone please tell me what’s wrong I’m doing in above regular expression?
Regular expressions can’t match ranges of numbers, like you’re doing with
[1-31]. It can only match ranges of characters. You would need to match[1-31]as([12]?[0-9]|3[01])instead—it’s not the most friendly thing in the world.