<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Capturing Multiple, Optional HTML Attribute Values</title>
	<atom:link href="http://blog.stevenlevithan.com/archives/multi-attr-capture/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.stevenlevithan.com/archives/multi-attr-capture</link>
	<description>A JavaScript and regular expression centric blog</description>
	<lastBuildDate>Tue, 09 Mar 2010 12:48:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Steve</title>
		<link>http://blog.stevenlevithan.com/archives/multi-attr-capture/comment-page-1#comment-16644</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Thu, 27 Mar 2008 00:47:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stevenlevithan.com/archives/multi-attr-capture#comment-16644</guid>
		<description>@Philip, I&#039;m not sure I understand what you&#039;re trying to do, since bold, italic, and underline are merely values for their related CSS properties. If you&#039;re just checking for the existence of certain words within your style attribute, that&#039;s unrelated to this post. Also, you haven&#039;t mentioned which regex flavor you&#039;re using.

In any case, if you need one-on-one regex advice I&#039;d recommend &lt;a href=&quot;http://regexadvice.com&quot; rel=&quot;nofollow&quot;&gt;regexadvice.com&lt;/a&gt; or the RegexBuddy forums.</description>
		<content:encoded><![CDATA[<p>@Philip, I&#8217;m not sure I understand what you&#8217;re trying to do, since bold, italic, and underline are merely values for their related CSS properties. If you&#8217;re just checking for the existence of certain words within your style attribute, that&#8217;s unrelated to this post. Also, you haven&#8217;t mentioned which regex flavor you&#8217;re using.</p>
<p>In any case, if you need one-on-one regex advice I&#8217;d recommend <a href="http://regexadvice.com" rel="nofollow">regexadvice.com</a> or the RegexBuddy forums.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phillip</title>
		<link>http://blog.stevenlevithan.com/archives/multi-attr-capture/comment-page-1#comment-16631</link>
		<dc:creator>Phillip</dc:creator>
		<pubDate>Wed, 26 Mar 2008 19:16:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stevenlevithan.com/archives/multi-attr-capture#comment-16631</guid>
		<description>Could you help me modify your regex so that it captures multiple attributes of a style? for example I want to capture only the styles bold, italics an underline.

&lt;code&gt;&lt;span style=&quot;font-style: italic; font-weight:bold; height:100px;&quot; class=&quot;class&quot; title=&quot;title&quot;&gt;styled text &lt;/span&gt; &lt;/code&gt;

many thanks</description>
		<content:encoded><![CDATA[<p>Could you help me modify your regex so that it captures multiple attributes of a style? for example I want to capture only the styles bold, italics an underline.</p>
<p><code>&lt;span style="font-style: italic; font-weight:bold; height:100px;" class="class" title="title"&gt;styled text &lt;/span&gt; </code></p>
<p>many thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blog.stevenlevithan.com/archives/multi-attr-capture/comment-page-1#comment-9989</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Fri, 21 Dec 2007 21:00:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stevenlevithan.com/archives/multi-attr-capture#comment-9989</guid>
		<description>@George, I&#039;m not sure what you&#039;re describing as &quot;the new string&quot;, but the regexes discussed here work fine in RegexBuddy 3.1. If you have v3.x, I would recommend asking for help on its integrated forum. If not, I would recommend you upgrade. ;)</description>
		<content:encoded><![CDATA[<p>@George, I&#8217;m not sure what you&#8217;re describing as &#8220;the new string&#8221;, but the regexes discussed here work fine in RegexBuddy 3.1. If you have v3.x, I would recommend asking for help on its integrated forum. If not, I would recommend you upgrade. <img src='http://blog.stevenlevithan.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: George Fisher</title>
		<link>http://blog.stevenlevithan.com/archives/multi-attr-capture/comment-page-1#comment-9926</link>
		<dc:creator>George Fisher</dc:creator>
		<pubDate>Thu, 20 Dec 2007 12:48:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stevenlevithan.com/archives/multi-attr-capture#comment-9926</guid>
		<description>Thanks again. I&#039;m probably doing something wrong but copying the new string into my trusty RegexBuddy doesn&#039;t produce a match. Without the backrefs, but not with.</description>
		<content:encoded><![CDATA[<p>Thanks again. I&#8217;m probably doing something wrong but copying the new string into my trusty RegexBuddy doesn&#8217;t produce a match. Without the backrefs, but not with.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blog.stevenlevithan.com/archives/multi-attr-capture/comment-page-1#comment-9907</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Thu, 20 Dec 2007 04:04:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stevenlevithan.com/archives/multi-attr-capture#comment-9907</guid>
		<description>@George, you&#039;re very welcome. Note that if you wanted the attributes to be required while maintaining the rest of the regex&#039;s flexibility, you could use backreferences to empty capturing groups like so (I&#039;ll just use the first two attributes from your regex to keep it short):

&lt;code&gt;&lt;img\b(?&gt;\s+(?:alt=&quot;([^&quot;]*)&quot;()&#124;class=&quot;([^&quot;]*)&quot;())&#124;[^\s&gt;]+&#124;\s+)*\2\4&gt;&lt;/code&gt;

Backref one would be the alt value, backref three would be the class value, and backrefs two and four are just overhead towards making the magic happen.</description>
		<content:encoded><![CDATA[<p>@George, you&#8217;re very welcome. Note that if you wanted the attributes to be required while maintaining the rest of the regex&#8217;s flexibility, you could use backreferences to empty capturing groups like so (I&#8217;ll just use the first two attributes from your regex to keep it short):</p>
<p><code>&lt;img\b(?&gt;\s+(?:alt="([^"]*)"()|class="([^"]*)"())|[^\s&gt;]+|\s+)*\2\4&gt;</code></p>
<p>Backref one would be the alt value, backref three would be the class value, and backrefs two and four are just overhead towards making the magic happen.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
