And testing with random whitespace;<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;">$text = &#39;
<span style="background-color: rgb(255, 255, 204);"><span style="background-color: rgb(255, 255, 0);"> style=&quot;&nbsp; font-style&nbsp; : italic&nbsp; ; font-weight&nbsp; : bold&nbsp; ;&nbsp; &quot; </span>&#39;</span>;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">$regex = &quot;\s*([a-z][a-z0-9\-]*)\s*:\s*([a-z][a-z0-9\-]*)\s*;&quot;;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
if (preg_match_all(&#39;/&#39;. $regex .&#39;/i&#39;, $text, $matches, PREG_SET_ORDER)) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp; 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;"><span style="font-family: courier new,monospace;">$style = array();
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">foreach ($matches as $match) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
&nbsp; $style[$match[1]] = $match[2];</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">}</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
print_r($style);</span></blockquote><div><br>works<br></div><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;">
Array</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">(</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; [0] =&gt; Array
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [0] =&gt;&nbsp;&nbsp; font-style&nbsp; : italic&nbsp; ;
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [1] =&gt; font-style</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [2] =&gt; italic</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; [1] =&gt; Array</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [0] =&gt;&nbsp; font-weight&nbsp; : bold&nbsp; ;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [1] =&gt; font-weight
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [2] =&gt; bold</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
Array</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">(</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; [font-style] =&gt; italic
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; [font-weight] =&gt; bold</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
)</span></blockquote><div><br>Testing with commonly practiced and supported syntactical errors and irregularities;<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;">$text = &#39;<span style="background-color: rgb(255, 255, 0);">style=font-style:italic;font-weight:bold</span>&#39;;</span><br></blockquote>doesn&#39;t all work<br></div><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;">Array</span><br><span style="font-family: courier new,monospace;">(</span><br><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; [0] =&gt; Array</span><br><span style="font-family: courier new,monospace;">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(</span><br><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[0] =&gt; font-style:italic;</span><br><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[1] =&gt; font-style</span><br><span style="font-family: courier new,monospace;">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[2] =&gt; italic</span><br><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)</span><br><span style="font-family: courier new,monospace;">)</span><br><span style="font-family: courier new,monospace;">
Array</span><br><span style="font-family: courier new,monospace;">(</span><br><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;[font-style] =&gt; italic</span><br><span style="font-family: courier new,monospace;">)</span>
</blockquote><div><br>It also doesn&#39;t work for non-textual properties, and property names starting with &#39;-&#39; exclude the &#39;-&#39;;<br><blockquote><span style="font-family: courier new,monospace;">
$text = &#39;style=border-width: 0 2em 10px 0; border-left: 1px solid #000; -moz-border-radius: foo;&#39;;</span><br style="font-family: courier new,monospace;"></blockquote><span>outputs<br></span><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
<span><span style="font-family: courier new,monospace;">Array</span></span><br style="font-family: courier new,monospace;"><span><span style="font-family: courier new,monospace;">(</span></span><br style="font-family: courier new,monospace;">
<span><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;[0] =&gt; Array</span></span><br style="font-family: courier new,monospace;"><span><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(</span></span><br style="font-family: courier new,monospace;">
<span><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[0] =&gt; moz-border-radius: foo;</span></span><br style="font-family: courier new,monospace;"><span><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[1] =&gt; moz-border-radius
</span></span><br style="font-family: courier new,monospace;"><span><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[2] =&gt; foo</span></span><br style="font-family: courier new,monospace;"><span><span style="font-family: courier new,monospace;">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)</span></span><br style="font-family: courier new,monospace;"><span></span><br style="font-family: courier new,monospace;"><span><span style="font-family: courier new,monospace;">)</span></span><br style="font-family: courier new,monospace;">
<span><span style="font-family: courier new,monospace;">Array</span></span><br style="font-family: courier new,monospace;"><span><span style="font-family: courier new,monospace;">(</span></span><br style="font-family: courier new,monospace;">
<span><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;[moz-border-radius] =&gt; foo</span></span><br style="font-family: courier new,monospace;"><span><span style="font-family: courier new,monospace;">)</span></span>
<br style="font-family: courier new,monospace;"><span></span></blockquote></div><span>This regex deals with those issues (but not the missing trailing semicolon &#39;;&#39; <span style="background-color: rgb(255, 255, 255); font-family: courier new,monospace;">
$regex = &quot;<span style="background-color: rgb(255, 255, 0);">\s*([a-z\-][a-z0-9\-]*)\s*:\s*([^;]*)\s*;</span>&quot;;<br><br></span></span><span>I&#39;m not sure what the best way to deal with that is given the context.&nbsp; Perhaps something like 
</span><span><span style="background-color: rgb(255, 255, 255); font-family: courier new,monospace;"><br></span></span><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
<span><span style="background-color: rgb(255, 255, 255); font-family: courier new,monospace;">$text = &#39;font-style:italic;font-weight:bold&#39;;</span></span><br><span><span style="background-color: rgb(255, 255, 255); font-family: courier new,monospace;">
$regex = &quot;\s*([a-z\-][a-z0-9\-]*)\s*:\s*([^;]*)\s*&quot;;</span></span><br><span><span style="background-color: rgb(255, 255, 255); font-family: courier new,monospace;">$styles = <span style="background-color: rgb(255, 255, 51);">
explode(&#39;;&#39;, $text)</span>;</span></span><br><span><span style="background-color: rgb(255, 255, 255); font-family: courier new,monospace;">$all_matches = array();</span></span><br><span><span style="background-color: rgb(255, 255, 255); font-family: courier new,monospace;">
<span style="background-color: rgb(255, 255, 51);">foreach($styles as $style)</span> {</span></span><br><span><span style="background-color: rgb(255, 255, 255); font-family: courier new,monospace;">&nbsp; if (preg_match(&#39;/&#39;. $regex .&#39;/i&#39;, $style, $matches)) {
</span></span><br><span><span style="background-color: rgb(255, 255, 255); font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; print_r($matches);</span></span><br><span><span style="background-color: rgb(255, 255, 255); font-family: courier new,monospace;">
&nbsp;&nbsp;&nbsp; $all_matches[] = $matches;</span></span><br><span><span style="background-color: rgb(255, 255, 255); font-family: courier new,monospace;">&nbsp; }</span></span><br><span><span style="background-color: rgb(255, 255, 255); font-family: courier new,monospace;">
}</span></span><br><span><span style="background-color: rgb(255, 255, 255); font-family: courier new,monospace;">$style = array();</span></span><br><span><span style="background-color: rgb(255, 255, 255); font-family: courier new,monospace;">
foreach ($all_matches as $match) {</span></span><br><span><span style="background-color: rgb(255, 255, 255); font-family: courier new,monospace;">&nbsp; $style[$match[1]] = $match[2];</span></span><br><span><span style="background-color: rgb(255, 255, 255); font-family: courier new,monospace;">
}</span></span><br><span><span style="background-color: rgb(255, 255, 255); font-family: courier new,monospace;">print_r($style);</span></span></blockquote><div><br>Bevan/ <br></div><br>