Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news-peer.in.tum.de!news.belwue.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <4702008.Z4qSRW7Nsu@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Fri, 28 Oct 2011 19:50:01 +0200 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 8Bit Subject: Re: Regular expression question Newsgroups: comp.lang.javascript References: <2997930.SPkdTlGXAF@PointedEars.de> <1674123.KyhKTayAOI@PointedEars.de> Followup-To: comp.lang.javascript MIME-Version: 1.0 Lines: 31 NNTP-Posting-Date: 28 Oct 2011 19:50:01 CEST NNTP-Posting-Host: 7ad3dfd0.newsspool4.arcor-online.net X-Trace: DXC=[naY=aJV\i@0YVY]kmLTlD4IUKIE4F=F8>FDZm8W4\YJNLYUVHKH;GI^G:nORfl[GG`A44Lnc9hJ@1O X-Complaints-To: usenet-abuse@arcor.de Xref: x330-a1.tempe.blueboxinc.net comp.lang.javascript:7797 Lasse Reichstein Nielsen wrote: > Thomas 'PointedEars' Lahn writes: >> Antony Scriven wrote: >>> is also the reason why Lasse's solution (using >>> String.prototype.lastIndexOf) is preferable IMHO. --Antony >> http://foo.example/bar > > My "solution" was very hardcoded to the format that the OP used, i.e., > ending in "/somename.html". > Since that was all the examples he gave, and no real textual explanation, It was clear enough to me that they wanted to know the last path component of a URI. > it's impossible to generalize further. Well, it wasn't. > Maybe I should have said that :) It was clear to me that your code was limited, however I saw and still see no good reason for doing that when the general solution – the one using RegExp, which was being asked for – is so obvious. PointedEars -- Danny Goodman's books are out of date and teach practices that are positively harmful for cross-browser scripting. -- Richard Cornford, cljs, (2004)