Forum Discussion

Simon_Jones_112's avatar
Simon_Jones_112
Icon for Nimbostratus rankNimbostratus
Sep 26, 2006

Matching a GUID in a querystring?

Hi all,

 

 

Anyone tell me why this won't work? Is it possible to use \w's in an IRule?

 

 

 

 

set querystring URI::query

 

if { $querystring contains "productid" } {

 

 

Match the GUID in product and redirect it to the URL:

 

set productid [regexp -all -inline -indices {\w{8}-\w{4}-\w{4}-\w{4}-\w{12}} [HTTP::uri]]

 

 

Log to syslog-ng

 

log local0. "Found product: $productid"

 

}

 

 

Simon

2 Replies

  • If \w isn't working, you might try expanding it to [A-Za-z0-9]. I'm not sure which regex library is used, but this might be a valid workaround.

     

     

    Edit: actually \w matches _ as well, so you could use [A-Za-z0-9_] as an equivalent to \w.

     

     

    Aaron