Forum Discussion
Nov 26, 2007
Regexps are bad if you absolutely don't need them. They are very resource intensive and in most cases, there are better alternatives. If you want to extract a field from a string separated by delimiters, you can use the iRule getfield command.
http://devcentral.f5.com/wiki/default.aspx/iRules/getfield.html
Click hereFor your example URI of "/sales/office" The following commmand would extract the field "sales".
set val [getfield [HTTP::uri] "/" 2]
This command extracts the specified field from the URI which is delimited by slashes "/". The first field would be the value before the first delimeter. In the case of a URI, it will always be an empty string. The second delimiter would be the value "sales", the third "office" and so on...
Hope this helps...
-Joe