At 9:03 PM +0000 2/25/07, Jonathan Buchanan wrote: >tedd wrote: >>Hi gang: >> >>I've reviewed several methods to parse strings, but what's the >>shortest/easiest method to parse the sting from: >> >>http://www.mydomain.com/firstdir/secondir/myfile.txt >> >>to: >> >>myfile.txt ? > >One possible method: > >var s = "http://www.mydomain.com/firstdir/secondir/myfile.txt"; >s.split("/").pop(); That's very fine, and my solution is not better, but I love regular expressions: var s = "http://www.mydomain.com/firstdir/secondir/myfile.txt"; s = s.replace ( /.*\// , "" ) means: change (to the empty string) the longest string (. = whatever, * = whatever number of times) ending with slash (escaped with backslash, since slash is the termination character for the regular expression). Emmanuel