Forum Discussion
Rodolphe_Aubin1
Aug 13, 2021Nimbostratus
How to check if a string parameter can be an IPv4 or an IPv6 or nothing in an iRule ?
How to deal with that question in the best optimized way to code it versus cycles ? "How to check if a string parameter can be an IPv4 or an IPv6 or nothing in an iRule ?" I have already looke...
PeteWhite
Aug 19, 2021Employee
string matching with ip addresses is a bit wonky but you could simply do this:
if { $string equals "" } {
# Empty string
} elseif { $string contains "." } {
# IPv4
} elseif { $string contains ":" } {
# IPv6
} else {
# error
}
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