Flagrant Badassery

A JavaScript and regular expression centric blog

All Posts Tagged With: "udf"

More URI-Related UDFs

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

parseUri: Split URLs in ColdFusion

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

REMatch (ColdFusion)

Following are some UDFs I wrote recently to make using regexes in ColdFusion a bit easier. The biggest deal here is my reMatch() function. reMatch(), in its most basic usage, is similar to JavaScript's String.prototype.match() method. Compare getting the first number in a string using reMatch() vs. built-in ColdFusion functions: reMatch: <cfset num = reMatch("\d+", […]

Read More