views:

26

answers:

1

I would like to ask if there is a possible way to select all rows from a table where the content of a column (varchar(255)) may contain characters others than standard english (a-zA-Z) or characters from different languages like Greek, French.

For example if the table contains the following data:

-- ID, Address --
|  1, "Test1"   | 
|  2, "Tåst2"   |
|  3, "Test1"   |

I would like to get only the 2nd row (2, "Tåst2")

I tried to use regular expression doing the following:

SELECT * FROM contact_info WHERE address NOT REGEXP '[a-zA-Z]';

But no luck!

Any help would be appreciated!

+1  A: 

Match the whole text

SELECT * 
FROM contact_info 
WHERE address NOT REGEXP '^[a-zA-Z0-9]*$';
Naktibalda
I guess the problem was with the start and regular expression ending!If i need also to allow other special characters like '.,<>' should i use them inside the [].right?
ppolyzos
Yes. There was 2 problems: 1. numbers wasn't included in set, 2. without star and end symbols and quantifier ( * ) your regex match was positive if it found one character from set in text.I recommend reading more in documentation http://dev.mysql.com/doc/refman/5.1/en/pattern-matching.html
Naktibalda