A collection of useful regular expressions illustrating their use in script as a solution to common tasks.
Example:
Parsing path and filename from the location object.
Without extension
function xtractFile_sans(data){
var m = data.match(/(.*)[\/\\]([^\/\\]+)\.\w+$/);
return {path: m[1], file: m[2]}
}
Full Name
function xtractFile(data){
var m = data.match(/(.*)[\/\\]([^\/\\]+\.\w+)$/);
return {path: m[1], file: m[2]}
}