0

I'm trying to find all non-asci characters I have in my DB in a specific table and column. In that column are stored Html description, and in some of them I've exotic or non-existing characters (for example: Hà¶ganà¤s ).

I'm triyng to match them with this query:

SELECT * FROM project_version WHERE description REGEXP '[^()\x00-\xFF\,\.-\<\>="\' /:;&=]'

But I think I'm missing something, cause it returns all of my records. Does anyone any advice?

Thanks in advance

teone
  • 2,153
  • 3
  • 25
  • 49
  • There's a similar question [here](http://stackoverflow.com/questions/401771/how-can-i-find-non-ascii-characters-in-mysql) that has multiple answers; [this answer](http://stackoverflow.com/a/11741314/2091410) may be the best - it was added much later so it doesn't have as many upvotes, but it looks solid. – Ed Gibbs Oct 01 '13 at 14:34
  • 1
    ASCII is actually only 0x00-0x7F, so `[^\x00-\x7F]` or `[\x80-\xFF]` will do it. – Gumbo Oct 01 '13 at 14:34

1 Answers1

0

Try moving hyphen to start or end otherwise it needs to be escaped also ^ will be treated as literal ^ in character class:

SELECT * FROM project_version WHERE description REGEXP '[()\x00-\x7F,.<>="\' /:;&=-]'
anubhava
  • 761,203
  • 64
  • 569
  • 643