Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: regexp negate string help

From: Baron Schwartz <baron(at)xaprb.com>
Date: Tue Sep 25 2007 - 19:50:17 EDT


MySQL's regex library doesn't have all those Perl features. You can use the pcre-compatible extension from http://www.xcdsql.org/MySQL/UDF/, or just use two clauses in the WHERE: one should be

col NOT RLIKE "linux$"

Baron

Tang, Jasmine wrote:
> Hi,
>
> I need to match anything that start with "foo" then followed by a string
> containing letter/number/underscore/dot but NOT end with the string
> "linux". When I use the pattern 'foo[(a-z|0-9|_|.)]+(?!linux)' , I got
> "ERROR 1139 (42000): Got error 'repetition-operator operand invalid'
> from regexp". I got the look-ahead assertion syntax (?!string) from
> Perl regexp, but mysql apparently doesn't like that.
>
> Specially, the following should match:
>
> foodafdlj_endwithx
> food3242jljlsd.endwithn
>
> but this should NOT match
>
> foosdfjl.blah_linux
>
> any suggestions?
>
> thanks!
>
>

-- 
MySQL General Mailing List
For list archives: 
http://lists.mysql.com/mysql
To unsubscribe:    
http://lists.mysql.com/mysql?unsub=lists@pantek.com
Received on Tue Sep 25 19:51:02 2007

This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 10:12:07 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library