What RegEx would delimit a list which was copied and pasted from a web page? <p>I have a form which accepts a list of keywords. I then convert the list into an array using <code>mb_split</code> in PHP for entry into the database. However, I'm unable to find a RegEx that delimits the list successfully. Users will typically be pasting data that was copied from a list on a web page. Here's what I'm trying:</p> <pre><code>mb_split('/\s+/', $keywords) </code></pre> <p>And here's the result in the database:</p> <pre><code>keyword1¶keyword2¶keyword3 </code></pre> <p>I would have thought that the ¶ character would have been considered whitespace covered by <code>\s+</code>. I tried handling the ¶ character specifically, but it didn't work:</p> <pre><code>mb_split('/\s+\u00B6/', $keywords) </code></pre> <p>So what RegEx <em>would</em> work here?</p> <p><strong>SOLUTION</strong></p> <p>I ended up using this:</p> <pre><code>mb_split('\n|\r|¶', $keywords) </code></pre> <p>I needed to add the <code>|</code> (logical OR) and actually paste the ¶ symbol into the regex. I also switched to using <code>\n</code> and <code>\r</code> instead of <code>\s</code> to avoid losing multi-word entries which involve spaces.</p>