List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:March 24 2002 6:12pm
Subject:Re: pattern matching (in text field)
View as plain text  
At 17:02 +0000 3/24/02, julian haffegee wrote:
>Hi all,
>I currently have
>$result = mysql_query ("SELECT title_id, title  FROM documents_tbl, url_tbl
>WHERE (documents_tbl.title_id = url_tbl.url_id) AND keywords LIKE '%$temp%'
>AND title_id != '$myrow[title_id]'");
>this works to an extent, but 'keywords' is a text field and if $temp is for
>example 'stem' I want it to match stem, and maybe stems but not system
>I thought
>keywords RLIKE '[\s|^]$temp%[\s|s|$]'
>this would allow for a word at the start , end, surrounded by whitespace, or
>Obviously this does not work (why else would I ask you all?).
>Can anyone tell me what simple concept I have overlooked!

For one thing, you're using [...] to try to construct alternations.
[...] is for character classes, (...) is for alternations.


a tough(?) query problemtobias@mjaumjau24 Mar
  • pattern matching (in text field)julian haffegee24 Mar
    • Re: pattern matching (in text field)Paul DuBois24 Mar