tags:

views:

61

answers:

2

Hi,

I m trying to match beignning of words in a mysql column that stores strings as varchar. Unfortunately, REGEXP does not seem to work for UTF-8 strings as mentioned here

So,

select * from names where name REGEXP '[[:<:]]Aandre';

does not work if I have name like Foobar Aándreas

However,

select * from names where name like '%andre%'

matches the row I need but does not guarantee beginning of words matches.

Is it better to do the like and filter it out on the application side ? Any other solutions?

A: 
select * from names where name like 'andre%'
Col. Shrapnel
A: 

A citation from tha page you mentioned:

Warning

The REGEXP and RLIKE operators work in byte-wise fashion, so they are not multi-byte safe and may produce unexpected results with multi-byte character sets. In addition, these operators compare characters by their byte values and accented characters may not compare as equal even if a given collation treats them as equal.

newtover