Scan - Making string manipulation efficient
One of the many things that makes iRules so powerful is the ability to inspect data and break it up into custom variables. You can store whatever information you need in your desired format and put i...
Published Apr 24, 2008
Version 1.0Colin_Walker_12
Historic F5 Account
Joined May 12, 2005
Colin_Walker_12
Historic F5 Account
Joined May 12, 2005
Al_Carandang_11
May 21, 2008Nimbostratus
There is a slight problem with your example
scan [HTTP::host] %s.%s.%s prefix host suffix
Since %s reads in all characters until the next whitespace, the whole [HTTP::host] string ends up in the variable 'prefix' and nothing is left to store in the succeeding variables. In addition, rather than setting these other variables to empty strings, they don't get defined at all so any succeeding reference to them generates a TCL error. The following would work
scan [HTTP::host] %\[^.\].%\[^.\].%s prefix host suffix