I am maintaining a program that uses TR1 regular expressions to evaluate user input for device settings. I have just switched the build environment for this program from visual studio 2008 to visual studio 2010. It was using the following regular expression to verify the form of an IP address:
^([0-9]{1,3})?(\.[0-9]{1,3}){0,3}$
The following is an example input that should have validated:
192.168.11.197
For some reason, under VS2010, this regular expression no longer validates a well formed IP address. I have resolved this problem by substituting this regular expression with the following (I found this on Regular expression to match DNS hostname or IP Address?:
^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
My question is why does the former regular expression no longer work? I will admit to not being a master of the subtleties of regular expression ASCII art but had thought that I had an understandable solution.