NYCPHP Meetup

NYPHP.org

[nycphp-talk] Regular Expression Assistance in MySQL

Dan Cech dcech at phpwerx.net
Wed Jul 20 10:27:05 EDT 2005


Peter Sawczynec wrote:
> I need this reg exp example you provided to also accept "OR a colon" on the
> left side only.

I would suggest starting here:

http://dev.mysql.com/doc/mysql/en/regexp.html

It is a good introduction to Regular expressions in MySQL and should 
give you all the information you need to craft the right regexp for your 
situation.

Dan

> Peter
> 
> -----Original Message-----
> From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On
> Behalf Of David Mintz
> Sent: Monday, July 18, 2005 10:34 PM
> To: NYPHP Talk
> Subject: Re: [nycphp-talk] Regular Expression Assistance in MySQL
> 
> 
> On Mon, 18 Jul 2005, Peter Sawczynec wrote:
> 
> 
>>The West and a Western South-westerly Revolt
>>
>>What is the reg exp that would match only the freestanding West and 
>>not match the West in Western or South-westerly.
> 
> 
> This seems to work:
> 
> mysql> SELECT 'The West and a Western South-westerly Revolt' REGEXP 
> mysql> BINARY
> '[[:<:]]West[[:>:]]' as matches;
> 
> +---------+
> | matches |
> +---------+
> |       1 |
> +---------+
> 1 row in set (0.01 sec)
> 
> (http://dev.mysql.com/doc/mysql/en/regexp.html)
> 
> ---
> David Mintz
> http://davidmintz.org/ _______________________________________________
> New York PHP Talk Mailing List
> AMP Technology
> Supporting Apache, MySQL and PHP
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.nyphp.org



More information about the talk mailing list