How can I use regular expressions in MySQL to rewrite the column value to be matched with an exact string? I can only find guides that do the opposite.
SELECT * FROM customers WHERE regexp_replace('([^0-9])', '', phone) = '0123456789';
The reason is that the column can contain all kinds of formatting e.g. "012-345 6789" "(0)12-3456789" and so on...
Please note: This is NOT a question about how data should better be stored. But wheither regexp replaces are possible or not. The example is only demonstrative to simplify the question and it's nature.
regexp_replace().