[Javascript] parse question

Mike Dougherty mdougherty at pbp.com
Mon Feb 26 08:03:49 CST 2007


On Mon, 26 Feb 2007 08:01:07 +0100
  Emmanuel <emmanuel at quomodo.com> wrote:
> var s = "http://www.mydomain.com/firstdir/secondir/myfile.txt";
> s = s.replace ( /.*\// , "" )

fwiw:  you might actually need to do something else with the source string, so maybe this:

var s = "http://www.mydomain.com/firstdir/secondir/myfile.txt";
var f = s.replace ( /.*\// , "" );

...would be more conservative?



More information about the Javascript mailing list