Page 1 of 1

Exact Word Regular Expression

Posted: Tue Feb 01, 2011 8:41 am
by roboto
Is it possible to search for exact word in REX?

<$test = 'test aaa test btestbb aaa'>

Rex should find only "test" word, not "btestbb".

Exact Word Regular Expression

Posted: Tue Feb 01, 2011 9:53 am
by John
Yes, you'll need three expressions for each end of the string, or to add spaces to the string, e.g.

<$s=">>=test=[^\alpha]\F=" "[^\alpha]\P=test=[^\alpha]\F=" "[^\alpha]\P=test=>>=" ">>=test=>>=">
<rex $s $test>

or

<strfmt " %s " $test>
<rex "[^\alpha]\P=test=[^\alpha]\F=" $ret>