Excuse the html email. It means I can highlight things and hence communicate more clearly.<br><br>First, I think you have an extra '+' character, which results in a double plus '++' being passed into preg_match()
<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote"><span style="font-family: courier new,monospace;">$regex = "(\s*([a-z][a-z0-9\-]*)\s*:\s*([a-z][a-z0-9\-]*)\s*;)
<span style="background-color: rgb(255, 255, 51);">+</span>";</span><br style="font-family: courier new,monospace;"><div style="direction: ltr; font-family: courier new,monospace;">if (preg_match('/'. $regex .'
<span style="background-color: rgb(255, 255, 51);">+</span>/i', $text, $matches)) {...</div></blockquote><br>which calls <span style="font-family: courier new,monospace;">preg_match('/(\s*([a-z][a-z0-9\-]*)\s*:\s*([a-z][a-z0-9\-]*)\s*;)
<span style="background-color: rgb(255, 255, 51);">++<span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">/i', 'style="font-style: italic; font-weight: bold;"', $matches))</span></span>
</span><br><br>Nevertheless, that's not the cause, because removing one or both plusses doesn't solve the problem.<br><br>The thing that strikes me as odd with this regex is the wrapping of the outer parenthesis, in a multiplier. I would instead look for a way of repeating the smaller regex on the string until the string is finished. This code;
<br><blockquote><span style="font-family: courier new,monospace;">$text = 'style="font-style: italic; font-weight: bold;"';</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
$regex = "\s*([a-z][a-z0-9\-]*)\s*:\s*([a-z][a-z0-9\-]*)\s*;";</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">if (preg_match_all('/'. $regex .'/i', $text, $matches, PREG_SET_ORDER)) {
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> print_r($matches);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
}</span><br style="font-family: courier new,monospace;"></blockquote>returns this;<br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote"><pre id="line1">
Array<br>(<br> [0] => Array<br> (<br> [0] => font-style: italic;<br> [1] => font-style<br> [2] => italic<br> )<br><br> [1] => Array<br> (<br> [0] => font-weight: bold;
<br> [1] => font-weight<br> [2] => bold<br> )<br><br><span id="__firefox-tidy-id" style="background-color: rgb(221, 221, 255);">)</span>
</pre></blockquote>Which I think is more similar to what you are seeking?<br><br>Also, I expect there is probably a php library that does this with simpler function calls than writing you're own ajax. Possibly as part of or related to the DOM class and related classes
<a href="http://nz.php.net/manual/en/ref.dom.php">http://nz.php.net/manual/en/ref.dom.php</a><br><br>Cheers,<br>Bevan/<br><br>-- <br><a href="http://Drupal.geek.nz">Drupal.geek.nz</a> | Gtalk <a href="mailto:bevan@lucion.co.nz">
bevan@lucion.co.nz</a> | YIM rudgy_m_nz | .Mac/AOL b.rudge | skype b.rudge | <a href="http://Twitter.com/BevanR">Twitter.com/BevanR</a>