Re: Pb searching a word in a string
Posted in 1996
Topics: General Discussion
Patrice,
If all word separators are known upfront then
something like this should work:
select * from my_tab
where search_col matches *exam[: ,]*.
Here the comma, semi-colon and space character
are explicited included as part of string
Doug Ellerbe
ellerbe@qsun.ho.att.com
} From rmy.emory.edu!informix-list-owner@caig2.att.att.com Thu Sep 26 07:49:13 1996
} >Received: by cagw2.att.com; Thu Sep 26 07:47 EDT 1996
} From: pdemeyer@tmphard.univ-lr.fr
} Subject: Pb searching a word in a string
} Date: 26 Sep 1996 07:12:36 GMT
} Reply-To: pdemeyer@tmphard.univ-lr.fr
} Organization: Universite de La Rochelle
} Sender: informix-list-owner@rmy.emory.edu
} To: informix-list@rmy.emory.edu
} X-Informix-List-To: ellerbe@qsun.ho.att.com
} X-Informix-List-Id: <news.28482>
} Content-Type: text
} Content-Length: 919
}
} Hi there!
}
} Here is the problem:
} Using OInformix, what is the trick to find a word in a string, but only THIS
} word. An example would be better :
}
} My fields are : "i flunked my exam" and "this is an example"
} If i want to find fields which contain the word 'exam', with the simple syntax
} *exam*, it will find the 2 fields, but I don't want the second one here.
}
} The difficulty here is to find the trick which works in every case,
} even if the searched word is at the beginning or at the end of the string,
} thinking that we could have other word separators than the space character
} (for example a comma character, the ':' character ...) and without using AND
} or OR clause in the select request (cauz the database is really huge, and I
} must optimize everywhere).
}
} Any help would be appreciated (even if you tell me that we can't do this).
} Thanx a lot
}
} -----------------------
} Patrice
} pdemeyer@cri.univ-lr.fr
}
}