<?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: Regex Performance Optimization</title>
	<atom:link href="http://blog.stevenlevithan.com/archives/regex-optimization/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.stevenlevithan.com/archives/regex-optimization</link>
	<description>A JavaScript and regular expression centric blog</description>
	<lastBuildDate>Thu, 09 Feb 2012 10:18:35 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Vimal</title>
		<link>http://blog.stevenlevithan.com/archives/regex-optimization/comment-page-1#comment-102346</link>
		<dc:creator>Vimal</dc:creator>
		<pubDate>Mon, 16 May 2011 09:25:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stevenlevithan.com/archives/regex-optimization#comment-102346</guid>
		<description>Hi.. I need to optimise the following reg exp so that it executes faster. Can anyone help? Thanks

^([\d\w]{15}[\x01]\d{12}[\x01]\d{2}(.){6}((13((0[0-9]&#124;([1-4][0-9])&#124;5[0-9]))&#124;14((0[0-9]&#124;([1-2][0-9])&#124;30)))[0-5][0-9])801(?:.*))$</description>
		<content:encoded><![CDATA[<p>Hi.. I need to optimise the following reg exp so that it executes faster. Can anyone help? Thanks</p>
<p>^([\d\w]{15}[\x01]\d{12}[\x01]\d{2}(.){6}((13((0[0-9]|([1-4][0-9])|5[0-9]))|14((0[0-9]|([1-2][0-9])|30)))[0-5][0-9])801(?:.*))$</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: red tea</title>
		<link>http://blog.stevenlevithan.com/archives/regex-optimization/comment-page-1#comment-97451</link>
		<dc:creator>red tea</dc:creator>
		<pubDate>Sun, 24 Apr 2011 08:10:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stevenlevithan.com/archives/regex-optimization#comment-97451</guid>
		<description>Red tea china tea sale:da hong pao,oolong tea,jin jun mei,lapsang souchong,red tea,china tea,chinese tea.Wu Yi Shan Tea of High Quality Worldwide Orders are Accepted:&lt;a href=&quot;http://www.redteachina.com&quot; rel=&quot;nofollow&quot;&gt;lapsang souchong&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Red tea china tea sale:da hong pao,oolong tea,jin jun mei,lapsang souchong,red tea,china tea,chinese tea.Wu Yi Shan Tea of High Quality Worldwide Orders are Accepted:<a href="http://www.redteachina.com" rel="nofollow">lapsang souchong</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shon</title>
		<link>http://blog.stevenlevithan.com/archives/regex-optimization/comment-page-1#comment-70108</link>
		<dc:creator>Shon</dc:creator>
		<pubDate>Mon, 10 Jan 2011 07:03:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stevenlevithan.com/archives/regex-optimization#comment-70108</guid>
		<description>Hi found good contents on the blog,
i am new to regex and have one query about it.
Suppose if  i have an expression (hello1) &#124; (hello2) &#124;(hello3)
Now on regex match i want to know which subexpression got matched, how can i get this information.</description>
		<content:encoded><![CDATA[<p>Hi found good contents on the blog,<br />
i am new to regex and have one query about it.<br />
Suppose if  i have an expression (hello1) | (hello2) |(hello3)<br />
Now on regex match i want to know which subexpression got matched, how can i get this information.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: asd0z</title>
		<link>http://blog.stevenlevithan.com/archives/regex-optimization/comment-page-1#comment-52434</link>
		<dc:creator>asd0z</dc:creator>
		<pubDate>Mon, 10 May 2010 13:03:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stevenlevithan.com/archives/regex-optimization#comment-52434</guid>
		<description>And what was other good material on the subject?</description>
		<content:encoded><![CDATA[<p>And what was other good material on the subject?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cacycle</title>
		<link>http://blog.stevenlevithan.com/archives/regex-optimization/comment-page-1#comment-39411</link>
		<dc:creator>Cacycle</dc:creator>
		<pubDate>Sat, 01 Aug 2009 23:18:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stevenlevithan.com/archives/regex-optimization#comment-39411</guid>
		<description>It can also help to &quot;chew up&quot; text that does not contain the matches inside the regExp itself.

For example a regExp that searches for non-word matches in plain text:

/(&lt;&#124;&gt;&#124;::&#124;--&#124;@&#124;###)/

could be sped up by adding an additional chew-up blind-match:

/(&lt;&#124;&gt;&#124;::&#124;--&#124;@&#124;###)&#124;[^&lt;&gt;:-@#]+/

The chew-up blind-match has then to be filtered out (e.g. as an empty match).

This also works for matches containing words:

/\b(http:&#124;ftp:&#124;gopher:)/

becomes:

/\b(http:&#124;ftp:&#124;gopher:)&#124;\b[^:]{7,}/

I had a gigantic regExp to parse wiki code for syntax highlighting, consisting of &quot;&#124;&quot;-separated subexpressions for all existing wiki codes. Just by adding a chew-up expression I cut the execution time in half (the code is for the Wikipedia editor wikEd and I was using JavaScript under Firefox 3.5).</description>
		<content:encoded><![CDATA[<p>It can also help to &#8220;chew up&#8221; text that does not contain the matches inside the regExp itself.</p>
<p>For example a regExp that searches for non-word matches in plain text:</p>
<p>/(&lt;|&gt;|::|&#8211;|@|###)/</p>
<p>could be sped up by adding an additional chew-up blind-match:</p>
<p>/(&lt;|&gt;|::|&#8211;|@|###)|[^&lt;&gt;:-@#]+/</p>
<p>The chew-up blind-match has then to be filtered out (e.g. as an empty match).</p>
<p>This also works for matches containing words:</p>
<p>/\b(http:|ftp:|gopher:)/</p>
<p>becomes:</p>
<p>/\b(http:|ftp:|gopher:)|\b[^:]{7,}/</p>
<p>I had a gigantic regExp to parse wiki code for syntax highlighting, consisting of &#8220;|&#8221;-separated subexpressions for all existing wiki codes. Just by adding a chew-up expression I cut the execution time in half (the code is for the Wikipedia editor wikEd and I was using JavaScript under Firefox 3.5).</p>
]]></content:encoded>
	</item>
</channel>
</rss>

