3

What is the best way to find control characters within a string in MySQL? I have a table and want to get all records, that contain control characters. Something like

SELECT * FROM Customer WHERE Name = *ControlCharFilter*;

in C# it would be

Customer.Where(x => x.Name.Any(y => char.IsControl(y));
fubo
  • 44,811
  • 17
  • 103
  • 137

2 Answers2

8

MySQL supports regular expressions with POSIX character classes:

SELECT * FROM Customer WHERE Name RLIKE '[[:cntrl:]]+'

There's more information here.

Ed Gibbs
  • 25,924
  • 4
  • 46
  • 69
-1
SELECT * FROM Customer WHERE Name = "%ControlCharFilter%";

or are you looking for something more complex?

jdu
  • 581
  • 2
  • 3