Forum Discussion
Mauricio_Cusine
Aug 22, 2007Nimbostratus
Validate IP address with regexp
Hello,
I am trying to check if a IP address is valid in the bigip with regexp (I don't know if anybody know other method).
The regexp is the follow but don't work. Anybody can help me?....
hooleylist
Aug 22, 2007Cirrostratus
What is happening when you test your regex? Does it just not match, or do you get a TCL error in the LTM log file (/var/log/ltm). It is hard to see what you've used, as DC munges the characters.
Here are two options from regexbuddy:
I've attached them in a file in case DC munges the characters.
Do you want to capture the match in backreferences? The first option doesn't use backreferences, the second one does:
IP address
Matches 0.0.0.0 through 255.255.255.255
Use this regex to match IP numbers with accuracy, without access to the individual IP numbers.
\b(??:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b
IP address
Matches 0.0.0.0 through 255.255.255.255
Use this regex to match IP numbers with accuracy.
Each of the 4 numbers is stored into a capturing group, so you can access them for further processing.
\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b
Aaron
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects