Forum Discussion

CraigM_17826's avatar
CraigM_17826
Icon for Altocumulus rankAltocumulus
Aug 02, 2011

non case senitive match in http class

Hi,

 

 

I currently use http classses to do redirects which used to be done in iRules. At the moment for the URI Path I use pattern strings and this has worked fine, however these are case sensative and I now need to all for a complete mix of upper/lower case characters in the URI. I assume the best bet is to use regex instead of pattern strings, but I cannot seem to get it to work. Can some kind soul our there provide me an example of a regex that would effectively do a non case sensative match on any given URI? Alternatively is there a way I can get the BigIP to convert whatever URI was supplied to lowercase? Apologies if this is a "noob" question. :)

 

 

Regards,

 

 

Craig

 

  • Put (?i) in front of your regular expression. This will make it case insensitive. The period and star at the end are representative of any character "." that is repeated 0 or more times "*". Be mindful to choose regex when adding these. Too many times I have added a regex as a pattern and wondered why it was not working.

     

     

    eg.

     

     

    (?i)^/hellothere.*

     

     

    Will match ...

     

     

    /heLLoTherehowareyou

     

    /hellotherehowareyou

     

    /HELLOTHERE

     

    /HelLothereHOWAREYOU

     

     

    Jarvil
  • Hi Jarvil,

     

    thanks for the reply. I'll give it a go. Would be nice if you could use iRules functions (ie) [string tolower] in the URI Path for pattern strings, but I suppose you can't have everything. :)

     

     

    Regards,

     

     

    Craig

     

     

     

  • Hi Jarvil,

     

     

    just an update, it seems to work though I had to add a $ to the end of the regex or else it would effectively do a wildcard starting_with match.

     

     

    For example

     

     

    (?i)^/advisors would match *any* URI starting with /advisors regardless of case.

     

    (?i)^/advisors$ would match /advisors only regardless of case which is what I need.

     

     

    Many thanks for pointing me in the right direction.

     

     

    Kind regards,

     

     

    Craig