JRS: In article <3f************@individual.net>, dated Wed, 18 May 2005
22:02:08, seen in news:comp.lang.javascript, Ron Eggler
<NO****@hotmail.com> posted :
if I got a String like: http://server/dir1/dir2/dir3/
how would i extract everything between '//' and the most left single '/'?
If you are sure that there are no slashes before the //, then
S = S.split('/')[2]
will do it, except if there are browsers that won't return an empty
string for S[1] - in which case consider
S = S.split(/\/+/)[1]
which assumes that the field you want is not empty.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.