Forum Discussion

Phil_Dindak's avatar
Phil_Dindak
Icon for Nimbostratus rankNimbostratus
Mar 28, 2018

Regex alternative suggestion for string replacement

I have a couple of regexes that work just fine.

                    log local0. "original [HTTP::uri]"
                    if { [HTTP::uri] matches_regex {/lpportal-\d+/?} } { 
                         regsub -- {/lpportal-\d+/?} [HTTP::uri] $portal p1
                         HTTP::uri $p1
                         log local0. "replaced [HTTP::uri]"
                      }

The regexes mean: /lpportal-\d+/? = look for “/lpportal-“ followed by at least one or more digits (\d+) and possibly a trailing “/” (/?)

However, I read here that regexes are one of the most expensive calls to make on the BIG-IP LTM. Look for alternative that is not so cpu expensive.

Thanks in advance!

Phil