Forum Discussion

Robert_47833's avatar
Robert_47833
Icon for Altostratus rankAltostratus
Aug 18, 2011

how to match string1?string2?

there is a string start with /cjj?cjj2,how to match it?

 

if{

 

$uri matches_regex "^/cjj?cjj2"

 

}

 

{ persist none

 

HTTP::redirect "http://www.stubhub.com/404.html"

 

}

 

does "?" can be matched in matches_regex?

 

or do we have other method to achieve this?

 

 

  • If I insist on using match_regex,

     

    $uri match_regex "^/cjj?cjj2"

     

    does it work?
  • Sure if you put a \ in front of the ? otherwise it represents any non-whitespace character. Its worth noting that any regex matching is significantly slower that's why there are many alternatives.

     

     

    Kevin (Jarvil)