Extract the filename from a URL
var regexp = /(\w|[-.])+$/ str = document.URL a = regexp.exec(str) alert(a[0])
Reference: Regular Expressions: Methods - Doc JavaScript [webreference.com]
DZone Snippets > jrobertson > regular
11304 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
James Robertson http://www.r0bertson.co.uk
var regexp = /(\w|[-.])+$/ str = document.URL a = regexp.exec(str) alert(a[0])
a = '547' /^\d\d\d$/ ~= a
a = '134323' /^[0-9]*$/ =~ a #result returns 0, indicating success