<?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: RegExp Escape</title>
	<atom:link href="http://mattsnider.com/languages/javascript/regexp-escape/feed/" rel="self" type="application/rss+xml" />
	<link>http://mattsnider.com/languages/javascript/regexp-escape/</link>
	<description>Understanding JavaScript and Frameworks</description>
	<pubDate>Tue, 06 Jan 2009 13:26:47 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Sony Santos</title>
		<link>http://mattsnider.com/languages/javascript/regexp-escape/comment-page-1/#comment-23349</link>
		<dc:creator>Sony Santos</dc:creator>
		<pubDate>Mon, 08 Sep 2008 12:24:02 +0000</pubDate>
		<guid isPermaLink="false">http://mattsnider.com/languages/javascript/regexp-escape/#comment-23349</guid>
		<description>Now I got it, thank you!</description>
		<content:encoded><![CDATA[<p>Now I got it, thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Snider</title>
		<link>http://mattsnider.com/languages/javascript/regexp-escape/comment-page-1/#comment-23024</link>
		<dc:creator>Matt Snider</dc:creator>
		<pubDate>Fri, 05 Sep 2008 19:53:49 +0000</pubDate>
		<guid isPermaLink="false">http://mattsnider.com/languages/javascript/regexp-escape/#comment-23024</guid>
		<description>Sony,

As it is currently written, the 'esc' function returns a string that must be passed into the instantiation call for RegExp. So you would want to do the following:

var r = new RegExp(RegExp.esc(str));

You could modify 'esc' to return the regular expression object, if you wanted to. However, I have written it this way so you can append to the escaped 'str' before creating a new regular expression.</description>
		<content:encoded><![CDATA[<p>Sony,</p>
<p>As it is currently written, the &#8216;esc&#8217; function returns a string that must be passed into the instantiation call for RegExp. So you would want to do the following:</p>
<p>var r = new RegExp(RegExp.esc(str));</p>
<p>You could modify &#8216;esc&#8217; to return the regular expression object, if you wanted to. However, I have written it this way so you can append to the escaped &#8217;str&#8217; before creating a new regular expression.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sony Santos</title>
		<link>http://mattsnider.com/languages/javascript/regexp-escape/comment-page-1/#comment-22950</link>
		<dc:creator>Sony Santos</dc:creator>
		<pubDate>Wed, 03 Sep 2008 12:00:14 +0000</pubDate>
		<guid isPermaLink="false">http://mattsnider.com/languages/javascript/regexp-escape/#comment-22950</guid>
		<description>Hello!

How is the best way to use the example 2 above? I am confused. I'm showing some tries below, by I believe there's a better way.

try 1:
var r = new RegExp((new Regexp()).esc(str));

try 2:
var r = new RegExp(str); r.esc(str);

try 3:
var r = new RegExp(str); r.esc();

try 4:
var r = new RegExp.esc(str); // does this work?

I sincerely don't believe I have to write RegExp or str twice.
I think it's simpler to use one stand-alone function (not a method), say escapeRE():

var r = new RegExp(escapeRE(str));</description>
		<content:encoded><![CDATA[<p>Hello!</p>
<p>How is the best way to use the example 2 above? I am confused. I&#8217;m showing some tries below, by I believe there&#8217;s a better way.</p>
<p>try 1:<br />
var r = new RegExp((new Regexp()).esc(str));</p>
<p>try 2:<br />
var r = new RegExp(str); r.esc(str);</p>
<p>try 3:<br />
var r = new RegExp(str); r.esc();</p>
<p>try 4:<br />
var r = new RegExp.esc(str); // does this work?</p>
<p>I sincerely don&#8217;t believe I have to write RegExp or str twice.<br />
I think it&#8217;s simpler to use one stand-alone function (not a method), say escapeRE():</p>
<p>var r = new RegExp(escapeRE(str));</p>
]]></content:encoded>
	</item>
</channel>
</rss>
