Forum Discussion

Darren_21048's avatar
Darren_21048
Icon for Nimbostratus rankNimbostratus
Jun 15, 2011

Regex in STREAM::expression

I am looking to implement a regex within STREAM::expression to find the User Comments section on our web pages which we mark with a specific begin and end comment in the HTML. I am using the following within the iRule (with the usual Stream::disable / enable etc. which I've stripped out here for readability) which in theory should perform a string replacement within that section of the web page.

 

 

STREAM::expression {@sectionbegin.+sectionend@}

 

 

 

when STREAM_MATCHED {

 

log local0. "matched: [STREAM::match]"

 

STREAM::replace "[string map {[^A-Za-z][fF][iI][nN][dD][^A-Za-z] *******} [STREAM::match]]"

 

}

 

 

 

 

The difficulty I'm having is getting the regex in STREAM::expression to match over line feeds / carriage returns. I've tried [.\r\n]+, [\s\s]+ and various others without success. I can get the match to work in part if I miss out sectionend from my example but do not match on a line feed.

 

 

 

Any suggestions or the correct regex for this would be most appreciated.

 

 

 

Thanks

 

 

 

Darren C

 

11 Replies