MySQL Select WHERE and removing characters <p>I have a PHP string that I need to match to a database but in order to match, I first need to make the WHERE part of the statement ignore some characters. For example:</p> <pre><code>$string = "This is the message. On a few different sentences to make it a bit longer"; </code></pre> <p>Needs to match to</p> <pre><code>&gt; This is the message. &gt; &gt; On a few different sentences to make it a bit longer </code></pre> <p>So what I need the WHERE to do is ignore '>','\r\n' and empty lines. I understand I can ignore the first 2 with something like</p> <pre><code>SELECT * FROM table WHERE REPLACE(REPLACE(fieldtomatch, '&gt;', ''), '\r\n', '') LIKE '%$string%' </code></pre> <p>But what about the empty lines?</p> <p>Any help much appreciated!</p>