Thursday, June 28th, 2007 •
Related •
Filed Under
I've just updated parseUri. If you haven't seen the older version, parseUri is a function which splits any well-formed URI into its parts, all of which are optional. Its combination of accuracy, flexibility, and brevity is unrivaled. Highlights: Comprehensively splits URIs, including splitting the query string into key/value pairs. (Enhanced) Two parsing modes: loose and […]
Read More
Tuesday, June 26th, 2007 •
Related •
Filed Under
N00b Thinks "regular expressions" is open mic night at a poetry bar. Uses \w, \d, \s, and other shorthand classes purely by accident if at all. Painfully misuses * and especially .*. Puts words in character classes. Uses | in character classes for alternation. Hasn't heard of the exec method. Copies and pastes poorly written […]
Read More
Saturday, June 23rd, 2007 •
Related •
Filed Under
The String.prototype.split method is very handy, so it's a shame that if you use a regular expression as its delimiter, the results can be so wildly different cross-browser that odds are you've just introduced bugs into your code (unless you know precisely what kind of data you're working with and are able to avoid the […]
Read More
Saturday, June 16th, 2007 •
Related •
Filed Under
Unlike lookaheads, JavaScript doesn't support regex lookbehind syntax. That's unfortunate, but I'm not content with just resigning to that fact. Following are three ways I've come up with to mimic lookbehinds in JavaScript. For those not familar with the concept of lookbehinds, they are zero-width assertions which, like the more specific \b, ^, and $ […]
Read More
Thursday, June 14th, 2007 •
Related •
Filed Under
I've never used the few scripts I've seen that add commas to numbers because usually I want to apply the functionality to entire blocks of text. Having to pull out numbers, add commas, then put them back becomes a needlessly complex task without a method which can just do this in one shot. So, here's […]
Read More