Exact Word Regular Expression

Post Reply
roboto
Posts: 14
Joined: Sat Jul 31, 2010 11:45 am

Exact Word Regular Expression

Post 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".
User avatar
John
Site Admin
Posts: 2597
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Exact Word Regular Expression

Post 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>
John Turnbull
Thunderstone Software
Post Reply