As part of one investigation, i had go do some experiments with the regular expressions and below is some findings on it.
^(?:(4|3|2|1)(\\.[0-9]{0,2}\\.[0-9]{0,2})|(?:(5)\\.[0-9]\\.[0-9]{0,2}))$
The above expression will check and make sure the version from 1 - 5 versions, and each version can be of format x.xx.xx
the above expression will return true for 5.0.xx - 5.9.xx But not anything on and above 5.10.xx
2. Now lets say, the rule #1 applies but as a special case, we want to introduce a scenario where we need to get TRUE for 6.1.3 , this is possible by modifying reg-ex like below
^(?:(6.1.3))|(?:(4|3|2|1)(\.[0-9]{0,2}\.[0-9]{0,2})|(?:(5)\.[0-9]\.[0-9]{0,2}))$
References:
http://www.perlmonks.org/?node_id=1094450
http://www.regular-expressions.info/tutorial.html
No comments:
Post a Comment