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 > expression
11381 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])