Forum Discussion
Eljay
Cirrus
Jun 27, 2019Using SCAN to validate an URI
I need to validate an URI. I'd like to use a policy but iRule works as well. I need to check if an URI is between 2 and 8 characters long and that it contains only digits and upper or lower lette...
Stanislas_Piro2
Cumulonimbus
Jun 28, 2019- URI always starts with / so your regex expression may not work.
- scan command is not the best solution to define length filtering
You can use following code in you irule to check both length filtering and format:
set uri [string range [HTTP::uri] 2 end]
if {([set length [string length $uri]] == 8 || $length == 2 ) && [string is alnum $uri ]} {
#actions if true
} else {
#actions if false
}
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