Forum Discussion

Jeff_41411's avatar
Jeff_41411
Icon for Altocumulus rankAltocumulus
May 09, 2012

uri replacement

Hi - I have a situation where we are being asked to strip some characters out of the URI, and pass that along to the back end servers.

 

 

I would like to do this with an iRule at this point, and we do not want to do a redirect.

 

 

I need to look for the following pattern in the URI:

 

 

/v..//

 

 

if the pattern is found, strip it out. (the number of digits in the pattern will always remain the same)

 

 

I've read about using regular expressions - and I've read that those are not really recommended due to the CPU overhead. I'm thinking something like the string match function would work.

 

 

I'm sure there are lots of ways to do this - seems pretty simple, but I'm wondering what the collective wisdom will come up with as the most efficient way to do this.

 

 

Thanks in advance for any examples/recommendations.

 

 

Jeff

 

 

  • Does the sequence in the URI always occur in the same path space? Meaning, is it always, say, the third entry from one side, like:

     

     

    /path0/path1/v.434132323.9049249434/path2/path3/base.ext

     

     

    or does it appear in various positions in the URI? If it's always in the same place, we can replace it without string-matching it.
  • I just found out - yes it will always be in the same location. The first position after the host/domain. We do still need to identify it however, as it may not 'always' be present in the URI.

     

     

    Also - forgot to mention that the '" in the pattern can be any digit (0-9), but will always be the same number of digits.

     

     

    Thanks for the help . . .