Forum Discussion
styles82_88530
Nimbostratus
Jan 28, 2008iRules + Case Sensitivity
Hi,
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.
1 Reply
- hoolio
Cirrostratus
Hi,
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
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