Forum Discussion
nnzaid_67752
Nimbostratus
Nov 14, 2011syntax for matches_glob
Hi, having syntax problems with matches_glob function. I have this, which works: if { $agent matches_glob "*android 2.1*" } { do something }, what I want to do is implement an OR type operator on a string within the string $agent. similar to switch -glob using - after the string match. Is this possible? I have not been able to find any syntax reference for the matches_glob command. thanks in advance.
3 Replies
- nnzaid_67752
Nimbostratus
The best I have been able to do is something like:
if { ($agent matches_glob "*android 2.1*") or ($agent matches_glob "*android 2.2*") or ($agent matches_glob "*os 1.0*") } { do something }.
but I am not sure of this is the most efficient way of doing something like this?
Any suggestions would be gratefully received.
thanks. - hoolio
Cirrostratus
Hi nnzaid,
The second syntax you have would work. But you can use a switch statement instead:when HTTP_REQUEST { switch [string tolower [HTTP::header User-Agent]] { "*android 2.*" - "*os 1.0*" { Do something } default { Do something else } } }
Aaron - nnzaid_67752
Nimbostratus
Thanks Aron.
Much appreciated.
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
