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 the
<cfloop> with one line of code if I didn't have to account for bugs in the
reFind() function (tested in CF7). Note that all components are split with a single regex, using backreferences. My favorite part of this UDF is its robust support for splitting the directory path and filename (it supports directories with periods, and without a trailing backslash), which I haven't seen matched in other URI parsers.
Since the function returns a struct, you can do, e.g.,
parseUri(uri).anchor, etc. Check it out: