Forum Discussion
how do I get "one of" functionality in version 9?
Also note that there is a big difference between which argument is on the left-hand side and which is on the right-hand side of the operator. This most notably has an effect on the starts_with, ends_with and contains operators.
In v4.x, the one of class operator always assumed the class was on the right-hand side and checked whether the left-hand side variable existed in the class.
With v9, you can flip the class and object around if you want. Anotherwards, there is a big difference between the following to command implementations:
[matchclass [HTTP::uri] ends_with $::image_ext] - checks whether the uri ends with one of the extensions in the image_ext class.
[matchclass $::bad_uris ends_with [HTTP::path]] - checks whether any of the strings in bad_uris end with the http path.
This difference may seem subtle, but is potentially important to understand.
Also, in this example, it would most likely be best to use the “equals” operator instead of the “contains” operator, since it is IP addresses you are comparing (does an IP address contain another IP address). It's also good to point out that IP addresses are compared in this case as strings.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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