|
|||||||||||
|
Re: Query to find "foo" within "(foo)"
From: Baron Schwartz <baron(at)xaprb.com>
Date: Thu Sep 20 2007 - 07:11:43 EDT
>> If you need something more complicated, such as only ignoring "(", then you
>> need to get more complicated. You might even need a regular expression.
> I'm to browse: > http://dev.mysql.com/doc/refman/5.0/en/regexp.html > http://www.wellho.net/regex/mysql.html You know, you don't have to do fancy regexp matching or even LIKE. There's really no advantage to using those over what looks like it'll be simpler in this case: INSTR().
SELECT INSTR('John (Johnie)', 'Johnie') AS John, INSTR('Peter',
'Johnie') AS Peter;
Just say "WHERE INSTR(haystack, needle) > 0" in your WHERE clause, and you're done. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=lists@pantek.comReceived on Thu Sep 20 11:13:59 2007 This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 10:11:18 EDT |
||||||||||
|
|||||||||||