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
Your original version works for me. Here is a quick method to test. If you change ::ip_address to an invalid IP, no match is found. If it is valid, a match is logged.
If the display of this regex is broken, you should be able to see it correctly by clicking reply and looking at the post.
when RULE_INIT {
set ::match {}
set ::ip_address "256.2.3.4"
set ::ip_address_regex {\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}
regexp $::ip_address_regex $::ip_address ::match
log local0. "\$::ip_address: $::ip_address; matched: $::match"
}
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