Forum Discussion
Nicholas_Zurfl1
Nimbostratus
Nov 03, 2005How to ignore case
Greetings,
I am a frequent lurker of the devcentral forums.
Does anyone know of a way to parse a payload and ignore case? My challange is that I am dealing with a proprietary protocol a...
Nov 03, 2005
There are several options you can go with here. If your payload isn't too large, then you could go with the above solution of using the string tolower command
if { [string tolower [TCP::payload]] contains "update" } {
...
}But, for large payloads, this might require too much memory usage that you would like to give up. In that case, you could use a regular expression search
if { [regexp {[Uu][Pp][Dd][Aa][Tt][Ee]} [TCP::payload]] == 1 } {
...
}Another thing to consider is whether you are going to be making a lot more than one comparison. Too many regexps might cause too much CPU usage for processing, so you might want to go back to the first method, but store it in a temporary variable so you don't have to create the temporary string for each match.
set content [string tolower [TCP::payload]]
if { $content contains "update" } {
...
} elseif { $content contains "command2" } {
...
}Lots of options. Choose the best for your situation.
-Joe
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
