Forum Discussion
1 Reply
Sort By
- hooleylistCirrostratusHi,
Sorry if this has been covered already, if it has been i couldnt find the thread.
Can you tell me if iRules are case sensitive?
Cheers,
S.
String comparisons in TCL and iRules are case sensitive by default. You can use 'string match -nocase' to perform a case insensitive comparison. For some reason the -nocase option for switch is disabled in iRules, so you can set the string to lower case using 'switch [string tolower $my_var] { test cases }'. I believe the HTTP::header commands are case insensitive, so if the client includes an HTTP request header of User-Agent, it will match a test of 'HTTP::header exists "user-agent"'.
In general, if you want to be sure about case, you can set the strings you're comparing to lower case using 'string tolower $test_string' when performing the comparison.
If you want more specific examples, post the rule you're working on and we can help out.
Aaron