Operator precedence

I’ve been looking at the documentation provided on iRule operators in the wiki, and the operator precedence for the F5-added operators is not listed. Is this information available anywhere?

Hi dlg,

The custom operators like “or” and “and” should be equivalent to the TCL || and &&. “not” is equivalent to !. equals is eq, etc.

Do you have a specific scenario you’re not sure about? If so, can you post a code snippet?

Thanks, Aaron

I don’t have any specific scenarios I’m concerned about right now, but it’s always nice to be able to point to actual documentation to explain why my code is correct.

For clarity’s sake, I mean the following operators from the aforementioned link:

Operand Description

contains Tests if one string contains another string

ends_with Tests if one string ends with another string

matches_glob Implement glob style matching within a comparison

matches_regex Tests if one string matches a regular expression

The other operators, as hoolio pointed out, map to existing TCL operators, which are sorted in order of precedence.

I think they’d fit in somewhere around the other string operators like eq/ne. Regardless, if you have any doubts, you can always use parentheses to make the precedence explicit:

if { ! ( [HTTP::uri] contains “my_string” ) } …

Aaron

Yes, I understand that I can add parentheses until I get the behavior I want. But I would like to have The Official Word all the same.

You could open a case with F5 Support to get the official view from F5. But I’m still not sure how it really matters whether contains takes precedence over ends_with etc. Can you explain exactly what you’re trying to figure out?

Aaron