Forum Discussion
Oct 05, 2009
checking URIs for ONLY single worded letters with no spaces
Hello all,
My objective is to find out if the incoming URI is a ALL single worded letters.
ex)
URL: http://www.hello.com/
GOOD URI:xyx/kkkj/asd
BAD URI:...
hoolio
Cirrostratus
Oct 06, 2009Hi,
The previous example would search the path and trigger the log statement if the path contained a space or encoded versions of a space. If you want to instead check for / and any alphanumeric character you could use scan ():
when HTTP_REQUEST {
Use scan to read in all characters from a-z, A-Z, 0-9 and /
Check if the scanned string is not the entire path
if {[scan [HTTP::path] {%[a-zA-Z0-9/]}] ne [HTTP::path]}{
log local0. "Path contained non-alphanumerics and /: [HTTP::path]. matched up to [scan [HTTP::path] {%[a-zA-Z0-9/]}]"
}
}
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
