NYCPHP Meetup

NYPHP.org

[nycphp-talk] Regular Expression Assistance in MySQL

David Mintz dmintz at davidmintz.org
Mon Jul 18 22:34:04 EDT 2005


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 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/



More information about the talk mailing list