<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Flagrant Badassery &#187; Project Releases</title>
	<atom:link href="http://blog.stevenlevithan.com/category/projects/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.stevenlevithan.com</link>
	<description>A JavaScript and regular expression centric blog</description>
	<pubDate>Sat, 09 Aug 2008 15:09:54 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>XRegExp 0.5 Released!</title>
		<link>http://blog.stevenlevithan.com/archives/xregexp-0-5</link>
		<comments>http://blog.stevenlevithan.com/archives/xregexp-0-5#comments</comments>
		<pubDate>Mon, 21 Apr 2008 00:43:35 +0000</pubDate>
		<dc:creator>Steven Levithan</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Project Releases]]></category>

		<category><![CDATA[Regular Expressions]]></category>

		<category><![CDATA[recursion]]></category>

		<category><![CDATA[xregexp]]></category>

		<guid isPermaLink="false">http://blog.stevenlevithan.com/archives/xregexp-0-5</guid>
		<description><![CDATA[If you haven't seen the prior versions, XRegExp is an MIT-licensed JavaScript library that provides an augmented, cross-browser implementation of regular expressions, including support for additional modifiers and syntax. Several convenience methods and a new, powerful recursive-construct parser that uses regex delimiters are also included.

Here's what you get beyond the standard JavaScript regex features:


	Added regex [...]]]></description>
			<content:encoded><![CDATA[<p>If you haven't seen the prior versions, <a href="http://stevenlevithan.com/regex/xregexp/">XRegExp</a> is an MIT-licensed JavaScript library that provides an augmented, cross-browser implementation of regular expressions, including support for additional modifiers and syntax. Several convenience methods and a new, powerful recursive-construct parser that uses regex delimiters are also included.</p>

<p>Here's what you get beyond the standard JavaScript regex features:</p>

<ul>
	<li>Added regex syntax:
		<ul>
			<li>Comprehensive named capture support. <strong class="small">(Improved)</strong></li>
			<li>Comment patterns: <code>(?#…)</code>. <strong class="small">(New)</strong></li>
		</ul>
	</li>
	<li>Added regex modifiers (flags):
		<ul>
			<li><code>s</code> (<em>singleline</em>), to make dot match all characters including newlines.</li>
			<li><code>x</code> (<em>extended</em>), for free-spacing and comments.</li>

		</ul>
	</li>
	<li>Added awesome:
		<ul>
			<li>Reduced cross-browser inconsistencies. <strong class="small">(More)</strong></li>
			<li>Recursive-construct parser with regex delimiters. <strong class="small">(New)</strong></li>
			<li>An easy way to cache and reuse regex objects. <strong class="small">(New)</strong></li>
			<li>The ability to safely embed literal text in your regex patterns. <strong class="small">(New)</strong></li>
			<li>A method to add modifiers to existing regex objects.</li>
			<li>Regex <code>call</code> and <code>apply</code> methods, which make generically working with functions and regexes easier. <strong class="small">(New)</strong></li>
		</ul>
	</li>
</ul>

<p>All of this can be yours for the low, low price of 2.4 KB. <img src="http://blog.stevenlevithan.com/wp-includes/images/smilies/icon_smile.gif" alt="smile" /> Version 0.5 also introduces <a href="http://stevenlevithan.com/regex/xregexp/">extensive documentation and code examples</a>.</p>

<p>If you're using a previous version, note that there are a few non-backward compatible changes for the sake of strict ECMA-262 Edition 3 compliance and compatibility with upcoming ECMAScript 4 changes.</p>

<ul>
	<li>The <code>XRegExp.overrideNative</code> function has been removed, since it is no longer possible to override native constructors in Firefox 3 or ECMAScript 4 (as proposed).</li>
	<li>Named capture syntax has been changed from <code>(&lt;name&gt;&hellip;)</code> to <code>(?&lt;name&gt;&hellip;)</code>, which is the standard in most regex libraries and under consideration for ES4. Named capture is now always available, and does not require the <code>k</code> modifier.</li>
	<li>Due to cross-browser compatibility issues, previous versions enforced that a leading, unescaped <code>]</code> within a character class was treated as a literal character, which is how things work in most regex flavors. XRegExp now follows ECMA-262 Edition 3 on this point. <code>[]</code> is an empty set and never matches (this is enforced in all browsers).</li>
</ul>

<p>Get it while it's hot! Check out the new <a href="http://stevenlevithan.com/regex/xregexp/">XRegExp documentation</a> and <a href="http://stevenlevithan.com/regex/xregexp/xregexp.js">source code</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.stevenlevithan.com/archives/xregexp-0-5/feed</wfw:commentRss>
		</item>
		<item>
		<title>Date Format 1.1</title>
		<link>http://blog.stevenlevithan.com/archives/date-format-1-0</link>
		<comments>http://blog.stevenlevithan.com/archives/date-format-1-0#comments</comments>
		<pubDate>Mon, 12 Nov 2007 03:57:05 +0000</pubDate>
		<dc:creator>Steven Levithan</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Project Releases]]></category>

		<category><![CDATA[date]]></category>

		<guid isPermaLink="false">http://blog.stevenlevithan.com/archives/date-format-1-0</guid>
		<description><![CDATA[I've just updated my ColdFusion-inspired JavaScript Date Format script to version 1.0 1.1, and updated the documentation in the old post along with it. The new release includes "Z" (US timezone abbreviation) and "o" (UTC offset) flags as well as brevity enhancements from Scott Trenda, along with several other new features including a standalone dateFormat [...]]]></description>
			<content:encoded><![CDATA[<p>I've just updated my ColdFusion-inspired <a href="http://blog.stevenlevithan.com/archives/date-time-format" class="bold">JavaScript Date Format</a> script to version <del>1.0</del> 1.1, and updated the documentation in the old post along with it. The new release includes "Z" (US timezone abbreviation) and "o" (UTC offset) flags as well as brevity enhancements from <a href="http://scott.trenda.net/">Scott Trenda</a>, along with several other new features including a standalone <code>dateFormat</code> function, named and default masks (plus you can easily add your own), easier internationalization, etc.</p>

<p>This update includes one change which is not backwards compatible: mask characters and sequences no longer have to comprise entire words for them to be treated specially. The former handling was intended to make it dead-easy to mix literal characters into date masks, but ended up mostly just being a slight nuisance since most people didn't use it to embed dates in larger strings.</p>

<p>Check out the new <a href="http://blog.stevenlevithan.com/archives/date-time-format">Date Format</a>!</p>

<hr/>
<p><strong>Edit:</strong> Date Format is now integrated into two JavaScript frameworks:</p>

<ul>
	<li><a href="http://cfjs.riaforge.org/" class="bold">CFJS</a> is a library of almost 70 ColdFusion functions written in JavaScript by <a href="http://cjordan.us/">Chris Jordan</a>. CFJS has used Date Format, which was a natural fit since it's largely based on ColdFusion's <code>dateFormat</code> and <code>timeFormat</code> functions, since version 0.1.</li>
	<li><a href="https://cixar.com/tracs/javascript" class="bold">Chiron</a> is an innovative, emerging JavaScript library by <a href="http://cixar.com/~kris.kowal/">Kris Kowal</a>. It's based on Python idioms, and at its heart is an <a href="http://modulesjs.com/">advanced module loader</a> and isolation system the likes of which hasn't been seen yet in the JavaScript world. In addition to integrating Date Format as a module called date.js, Chiron has also integrated my <a href="http://blog.stevenlevithan.com/archives/xregexp-named-capture">XRegExp</a> library, and uses regular expressions from <a href="http://blog.stevenlevithan.com/archives/parseuri">parseUri</a> in its core. Expect to hear more about Chiron as it gets closer to 0.1 release.</li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://blog.stevenlevithan.com/archives/date-format-1-0/feed</wfw:commentRss>
		</item>
		<item>
		<title>RegexPal Now Open Source</title>
		<link>http://blog.stevenlevithan.com/archives/regexpal-now-open-source</link>
		<comments>http://blog.stevenlevithan.com/archives/regexpal-now-open-source#comments</comments>
		<pubDate>Sun, 11 Nov 2007 00:21:24 +0000</pubDate>
		<dc:creator>Steven Levithan</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Project Releases]]></category>

		<category><![CDATA[Regular Expressions]]></category>

		<category><![CDATA[regexpal]]></category>

		<guid isPermaLink="false">http://blog.stevenlevithan.com/archives/regexpal-now-open-source</guid>
		<description><![CDATA[RegexPal (easily the most del.icio.used regex tester ) is now released under the Creative Commons Attribution-Share Alike 3.0 License GNU LGPL.

There are certainly many more features that can be added to the app and things that can be improved, so if you are interested in helping out or creating your own version, you are welcome [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://regexpal.com/" class="bold">RegexPal</a> (easily the most <a href="http://del.icio.us/url/96c4a2db554aedd7250fceafd58ede48">del.icio.us</a>ed regex tester <img src="/wp-includes/images/smilies/icon_wink.gif" alt="wink"/>) is now released under the <s>Creative Commons Attribution-Share Alike 3.0 License</s> <a href="http://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License">GNU LGPL</a>.</p>

<p>There are certainly many more features that can be added to the app and things that can be improved, so if you are interested in helping out or creating your own version, you are welcome to do so. If there is interest I'll create a Google Code project, but for now there is a <a href="http://regexpal.com/code/regexpal.zip" class="bold">package</a> you can download which includes all files for the regexpal.com website. Two of the files in the package (xregexp.js and helpers.js) are dual-licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT License</a>.</p>

<p>If you're only interested in the JavaScript, you can see the three source files here:</p>

<ul class="tight">
	<li><a href="http://regexpal.com/assets/xregexp.js">xregexp.js</a></li>
	<li><a href="http://regexpal.com/assets/helpers.js">helpers.js</a></li>
	<li><a href="http://regexpal.com/assets/regexpal.js">regexpal.js</a></li>
</ul>

<p>For regex aficionados particularly, there is some stuff here you might find interesting, including the latest, as-yet-unreleased version of my XRegExp library, and the regex syntax parser used for RegexPal's syntax highlighting (which includes lots of details on the minutiae of regex syntax and cross-browser regex handling).</p>]]></content:encoded>
			<wfw:commentRss>http://blog.stevenlevithan.com/archives/regexpal-now-open-source/feed</wfw:commentRss>
		</item>
		<item>
		<title>RegexPal: Web-Based Regex Testing Reinvented</title>
		<link>http://blog.stevenlevithan.com/archives/regexpal</link>
		<comments>http://blog.stevenlevithan.com/archives/regexpal#comments</comments>
		<pubDate>Sun, 05 Aug 2007 22:31:33 +0000</pubDate>
		<dc:creator>Steven Levithan</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Project Releases]]></category>

		<category><![CDATA[Regular Expressions]]></category>

		<category><![CDATA[regexpal]]></category>

		<guid isPermaLink="false">http://blog.stevenlevithan.com/archives/regexpal</guid>
		<description><![CDATA[Yes I know, there are many other JavaScript regex testers available. Why did I create yet another? RegexPal brings several new things to the table for such web-based apps, and in my (biased) opinion it's easier to use and more helpful towards learning regular expressions than the others currently available. Additionally, most other such tools [...]]]></description>
			<content:encoded><![CDATA[<p>Yes I know, there are many other JavaScript regex testers available. Why did I create yet another? <a href="http://regexpal.com/">RegexPal</a> brings several new things to the table for such web-based apps, and in my (biased) opinion it's easier to use and more helpful towards learning regular expressions than the others currently available. Additionally, most other such tools are very slow for the kind of data I often work with. They might appear fast when displaying 10 matches, but what about 100, 1000, or 5000? Try generating 5,000 matches (which is easy to do with an any-character pattern such as a dot) in your favorite existing web-based tool and see if your browser ever recovers (doubtful). The same task takes RegexPal less than half a second, and what's more, results overlay the text while you're typing it.</p>

<p>At the moment, RegexPal is short on features, but here are the highlights:</p>

<ul>
	<li>Real-time regex syntax highlighting with backwards and forwards context awareness.</li>
	<li>Lightning-fast match highlighting with alternating styles.</li>
	<li>Inverted matches (match any text not matched by the regex).</li>
</ul>

<div style="text-align:center; margin-bottom:15px;">
	<a href="http://regexpal.com/"><img src="http://regexpal.com/misc/screenshot.gif" width="445" height="288" alt="regexpal.com screenshot" /></a>
</div>

<p>I'm not sure when I'll add additional features, but there are lots of things I'm considering. If there is something you'd like to see, let me know.</p>

<p>A few things to be aware of:</p>

<ul>
	<li>The approach I've used for scrollable rich-text editing (which I haven't seen elsewhere) is fast but a bit buggy. Firefox 2 and IE7 have the least issues, but it more or less works in other browsers as well.</li>
	<li>The syntax highlighting generally marks corner-case issues that create cross-browser inconsistencies as errors even if they are the result of browser bugs or missing behavior documentation in ECMA-262 v3.</li>
	<li>There are different forms of line breaks cross-platform/browser. E.g., Firefox uses <code>\n</code> even on Windows where nearly all programs use <code>\r\n</code>. This can affect the results of certain regexes.</li>
</ul>

<p>At least for me, RegexPal is lots of fun to play with and helps to make learning regular expressions easy through its instant feedback. I encourage you to just go play with it and <a href="http://regexpal.com/">discover its results</a> on your own, but for the curious, I'll keep rambling&hellip;</p>

<p>Regex syntax parsing (needed for the syntax highlighting) is somewhat complex, due to the numerous backwards and forwards context awareness issues involved. Take, for example, the pattern <code>\10</code>. What does it mean?</p>

<ul>
	<li>Backreference 10, if not inside a character class and at least 10 capturing groups are opened before that point.</li>
	<li>Backreference 1, followed by a literal "0", if not inside a character class and between 1 and 9 capturing groups are opened before that point.</li>
	<li>Octal character index 10 (decimal 8), if inside a character class, or if no capturing groups are opened before that point.</li>
	<li>The three literal characters "\", "1", and "0", if preceded by an unescaped "\" character.</li>
	<li>An incomplete token in a couple other situations.</li>
</ul>

<p>Another example is the "-" character. Outside a character class it's always a literal hyphen, but inside a character class&hellip;</p>

<ul>
	<li>It creates a range between tokens if:
		<ul>
			<li>There is a preceding and following token in the class, or it's preceded by a token and is the last character in an unclosed character class (caveats follow).</li>
		</ul>
	</li>
	<li>It's a literal character if:
		<ul>
			<li>It's the first or last character in the class.</li>
			<li>It's preceded by an unescaped "\".</li>
			<li>It follows a token which is the end index for a range.</li>
			<li>It follows a hyphen which creates a range.</li>
		</ul>
	</li>
	<li>It's an error if:
		<ul>
			<li>It's creating a range between tokens in reverse character index order (e.g., <code>z-a</code>, <code>@-!</code>, <code>\uFFFF-\b</code>, or <code>\127-\cB</code>).</li>
			<li>It would otherwise create a range, but it's followed or preceded by a token which represents more than one character index (e.g., <code>\d</code>). In fact, in some cases browsers take this to mean that the hyphen should be treated as a literal, but browser bugs cause it to be handled inconsistently so RegexPal flags it as a range error.</li>
		</ul>
	</li>
</ul>

<p>Here are a few more things which aren't errors but are flagged as such:</p>

<ul>
	<li>Empty, top-level alternation, except at the end of the pattern, where such an alternation is ignored when highlighting matches in order to create a less surprising experience while the user is in the middle of constructing the regex. Empty, top-level alternation is flagged as an error because it effectively truncates the regex at that point (since it will always match). If a zero-length, top-level alteration is really needed, there are other easy ways to do that more explicitly.</li>
	<li>Lookaround quantifiers (e.g., the plus sign in <code>(?!x)+</code>). This would be an actual error with some regex libraries (e.g., PCRE), and although that's not the case in most web browsers, such constructs add no value. As a result, RegexPal flags such quantifiers as an error, since they are almost certainly a user mistake.</li>
	<li><code>\c</code> when not followed by A&ndash;Z, <code>\x</code> when not followed by two hex characters, and <code>\u</code> when not followed by four hex characters. Although these do not cause most browsers to throw errors, they are handled inconsistently cross-browser and are hence flagged as errors. They would almost certainly be a user mistake even if the cross-browser issues didn't exist.</li>
</ul>

<p>Credit to <a href="http://osteele.com/">osteele.com</a> from where the text of the short-and-sweet Quick Reference is based, and to <a href="http://www.regexbuddy.com/cgi-bin/affref.pl?aff=SteveL">RegexBuddy</a> from <abbr title="Just Great Software">JGsoft</abbr> for inspiring many of RegexPal's features. The name RegexPal is, in part, a nod to RegexBuddy, but also selected because it contains both "regex" and "regexp." <img src="/wp-includes/images/smilies/icon_wink.gif" alt="wink" /></p>]]></content:encoded>
			<wfw:commentRss>http://blog.stevenlevithan.com/archives/regexpal/feed</wfw:commentRss>
		</item>
		<item>
		<title>Safari Support with XRegExp 0.2.2</title>
		<link>http://blog.stevenlevithan.com/archives/xregexp-safari</link>
		<comments>http://blog.stevenlevithan.com/archives/xregexp-safari#comments</comments>
		<pubDate>Fri, 13 Jul 2007 03:24:59 +0000</pubDate>
		<dc:creator>Steven Levithan</dc:creator>
		
		<category><![CDATA[Cross-Browser Issues]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Project Releases]]></category>

		<category><![CDATA[Regular Expressions]]></category>

		<category><![CDATA[xregexp]]></category>

		<guid isPermaLink="false">http://blog.stevenlevithan.com/archives/xregexp-safari</guid>
		<description><![CDATA[When I released XRegExp 0.2 several days ago, I hadn't yet tested in Safari or Swift. When I remembered to do this shortly afterwards, I found that both of those WebKit-based browsers didn't like it and often crashed when trying to use it! This was obviously a Very Bad Thing, but due to major time [...]]]></description>
			<content:encoded><![CDATA[<p>When I released <a href="http://blog.stevenlevithan.com/archives/xregexp-named-capture">XRegExp 0.2</a> several days ago, I hadn't yet tested in Safari or Swift. When I remembered to do this shortly afterwards, I found that both of those WebKit-based browsers didn't like it and often crashed when trying to use it! This was obviously a Very Bad Thing, but due to major time availability issues I wasn't able to get around to in-depth bug-shooting and testing until tonight.</p>

<p>It turns out that Safari's regex engine contains a bug which causes an error to be thrown when compiling a regex containing a character class ending with "<code>[\\</code>".</p>

<pre class="code"><span class="comment">// These throw an error:</span>
[ <span class="regex">/[[\\]/</span> , <span class="regex">/[^[\\]/</span> , <span class="regex">/[abc[\\]/</span> ]

<span class="comment">// ...While these are all fine:</span>
[ <span class="regex">/[\\[]/</span> , <span class="regex">/[\[\\]/</span> , <span class="regex">/[[]/</span> , <span class="regex">/[\\]/</span> , <span class="regex">/[[\\abc]/</span> , <span class="regex">/[[\/]/</span> , <span class="regex">/[[(\\]/</span> ]

<span class="comment">// Testing:</span>
try {
	RegExp("[[\\]");
	alert("OK!");
} catch (err) {
	alert(err);
	<span class="comment">/* Safari shows:
	"SyntaxError: Invalid regular expression: missing terminating ] for
	character class" */</span>
}
</pre>

<p>As a result, I've changed two instances of <code>[^[\\]</code> to <code>[^\\[]</code> and upped the version number to 0.2.2. XRegExp has now been tested and works without any known issues in all of the following browsers:</p>

<ul>
	<li>Internet Explorer 5.5 &ndash; 7</li>
	<li>Firefox 2.0.0.4</li>
	<li>Opera 9.21</li>
	<li>Safari 3.0.2 beta for Windows</li>
	<li>Swift 0.2</li>
</ul>

<p>You can get the new version <a href="/archives/xregexp-named-capture">here</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.stevenlevithan.com/archives/xregexp-safari/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
