rex for words

sourceuno
Posts: 225
Joined: Mon Apr 09, 2001 3:58 pm

rex for words

Post by sourceuno »

I want to be able to check if certain words are part of a variable that can contain more than 1 word. In detail, I have a noise list that contains common words and I want to be able to check a query to see if it contains any of these noise words. How can I use rex to perform this check?
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

rex for words

Post by mark »

<$noiselist="[^\alnum]the[^\alnum]" "[^\alnum]a[^\alnum]">
<sum " %s " $query>
<rex $noiselist $ret>
<if $ret ne "">
has noise
</if>

or

<apicp keepnoise 1>
<$noiselist="(the,a)">
<if $query like $noiselist>
has noise
</if>


What are you going to do if do/don't find noise words in the query?
sourceuno
Posts: 225
Joined: Mon Apr 09, 2001 3:58 pm

rex for words

Post by sourceuno »

If the query is a noise word alone, I want to alert the user that he is using a common word. If the query contains a noise word along with other non-noise words, I want to warn the user that the noise word will be ignored in the search.