Split a string with <span> using preg_split() <p>I have a sting that is in this format.</p> <pre><code>&lt;span class="amount"&gt;$25&lt;/span&gt;–&lt;span class="amount"&gt;$100&lt;/span&gt; </code></pre> <p>What I need to do is split that into two strings. The string will remain in the same format but the prices will change. I tried using str_split() but because the price changes I wouldn't be able to always know how many characters to split the string at. </p> <p>What I am trying to get is something like this.</p> <p>String 1 </p> <pre><code>&lt;span class="amount"&gt;$25&lt;/span&gt;– </code></pre> <p>String 2</p> <pre><code>&lt;span class="amount"&gt;$100&lt;/span&gt; </code></pre> <p>It seems the best option I have found is to use preg_split() but I don't know anything about regex so I'm not sure how to format the expression. There may also be a better way to handle this and I just don't know of it.</p> <p>Could someone please help me format the regex, or let me know of a better way to split that string.</p> <h3>Edit</h3> <p>Thanks to @rm-vanda for helping me figure out that I don't need to use preg_split for this. I was able to split the string using explode(). The issue I was having was because the '-' was encoded weird and therefore not returning correctly.</p>