Creating an array of strings from a string
<p>I have a long string.  Within that string there are certain characters I need to watch for and process:</p>

<pre><code>$lyrics = "This is an {G}example of a {D}long string.  It's {Em}getting {C}longer and {Am}longer the more I {Dm7-5}type"
</code></pre>

<p>What I want to do is find the occurrences of the curly braces, and if the LENGTH of the string I find in between the curly braces is less than X, do thing A and if it's equal to or greater than X, do thing B.  </p>

<p>Both thing A and thing B involve changing the curly braces to HTML.</p>

<p>I've been searching and thinking about this problem for many days now and I've yet to find an approach that's succinct and simple.  </p>

<p>Of course I could treat the string as an array and loop through - but really?  Is this really a matter of me starting with the first character in $lyrics and marching through to the end? </p>

<p>Is there an obviously simpler solution I'm missing?  Would regular expressions help?  I know what regular expressions are, but I confess I've not had to work with them much.</p>
