IP ADDRESS VALIDATION IN APEX
669332Oct 21 2009 — edited Oct 24 2009Hi,
I am trying to check whether the IP Address lies within the range 1.1.1.1 and 255.255.255.255 or not.
I am using the following Regular expression for doing this.
(?<First>2[0-4]\d|25[0-5]|[01]?\d\d?)\.(?<Second>2[0-4]\d|25[0-5]|[01]?\d\d?)\.(?<Third>2[0-4]\d|25[0-5]|[01]?\d\d?)\.(?<Fourth>2[0-4]\d|25[0-5]|[01]?\d\d?)
This expression is working fine in Expresso and it validates the correct values.
But in apex, it is acting weird. Its not allowing me to enter 129.7.235.145. And it takes 129.7.23.256 as a correct value.
Can someone help me with this?
Thanks,
Gargi