Wednesday, February 7th, 2007 •
Related •
Filed Under
Update: The following post is outdated. See parseUri 1.2 for the latest, greatest version. For fun, I spent the 10 minutes needed to convert my parseUri() ColdFusion UDF into a JavaScript function. For those who haven't already seen it, I'll repeat my explanation from the other post… parseUri() splits any well-formed URI into its parts […]
Read More
Sunday, February 4th, 2007 •
Related •
Filed Under
In my previous post, one of the examples I used of when capturing groups are appropriate demonstrated how to match quoted strings: (["'])(?:\\\1|.)*?\1 (Note: This has some issues. See Edit 2, at the end of this post, if you intend to use this in an application.) To recap, that will match values enclosed in either […]
Read More
Sunday, February 4th, 2007 •
Related •
Filed Under
I near-religiously use non-capturing groups whenever I do not need to reference a group's contents. Recently, several people have asked me why this is, so here are the reasons: Capturing groups negatively impact performance. The performance hit may be tiny, especially when working with small strings, but it's there. When you need to use several […]
Read More
Saturday, February 3rd, 2007 •
Related •
Filed Under
To follow up my parseUri() function, here are several more UDFs I've written recently to help with URI management: getPageUri() Returns a struct containing the relative and absolute URIs of the current page. The difference between getPageUri().relative and CGI.SCRIPT_NAME is that the former will include the query string, if present. matchUri(testUri, [masterUri]) Returns a Boolean […]
Read More
Thursday, February 1st, 2007 •
Related •
Filed Under
Update: I've added a JavaScript implementation of the following UDF. See parseUri: Split URLs in JavaScript. Here's a UDF I wrote recently which allows me to show off my regex skillz. parseUri() splits any well-formed URI into its components (all are optional). The core code is already very brief, but I could replace everything within […]
Read More