Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #7800

Re: Regular expression question

From Antony Scriven <adscriven@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: Regular expression question
Date 2011-10-28 11:41 -0700
Organization http://groups.google.com
Message-ID <7623c451-a261-4495-a124-9ea0dbddc827@er6g2000vbb.googlegroups.com> (permalink)
References (3 earlier) <d20558c5-26d2-4464-9068-db92e87fec9e@a17g2000yqj.googlegroups.com> <c21d1200-abd0-430b-a97e-77c5bcecab47@i15g2000yqm.googlegroups.com> <1674123.KyhKTayAOI@PointedEars.de> <vcr93vsq.fsf@gmail.com> <4702008.Z4qSRW7Nsu@PointedEars.de>

Show all headers | View raw


On Oct 28, 6:50 pm, Thomas 'PointedEars' Lahn wrote:

 > Lasse Reichstein Nielsen wrote:
 > > Thomas 'PointedEars' Lahn <PointedE...@web.de> 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.

Cough.

 > > Maybe I should have said that :)

Unless you have Asperger's or some other similar condition,
I don't think there's any difficulty in understanding what
Lasse wrote, and its implications.

 > 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.

Well, I already showed that that isn't so. And if an expert
such as yourself can't make an obvious regexp match the
specification, then I think there is a lesson to be learnt
there. Regexps can be powerful, terse, and convenient, but
they can be very tricky things to get right, even the simple
ones. --Antony

P.S. Having said what I've said, I think it's a good thing
that its regexps are somewhat limited compared to some other
implementations.

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Regular expression question cerr <ron.eggler@gmail.com> - 2011-10-25 21:43 -0700
  Re: Regular expression question Mike Duffy <never@you.mind.com> - 2011-10-26 12:11 +0000
  Re: Regular expression question Denis McMahon <denismfmcmahon@gmail.com> - 2011-10-26 16:54 +0000
  Re: Regular expression question Lasse Reichstein Nielsen <lrn.unread@gmail.com> - 2011-10-26 19:33 +0200
    Re: Regular expression question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-26 23:40 +0200
      Re: Regular expression question Antony Scriven <adscriven@gmail.com> - 2011-10-27 17:30 -0700
        Re: Regular expression question Antony Scriven <adscriven@gmail.com> - 2011-10-27 17:39 -0700
          Re: Regular expression question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-28 03:50 +0200
            Re: Regular expression question Antony Scriven <adscriven@gmail.com> - 2011-10-28 08:46 -0700
            Re: Regular expression question Lasse Reichstein Nielsen <lrn.unread@gmail.com> - 2011-10-28 18:50 +0200
              Re: Regular expression question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-28 19:50 +0200
                Re: Regular expression question Antony Scriven <adscriven@gmail.com> - 2011-10-28 11:41 -0700
                Re: Regular expression question Antony Scriven <adscriven@gmail.com> - 2011-10-28 12:54 -0700
  Re: Regular expression question Dr J R Stockton <reply1143@merlyn.demon.co.uk> - 2011-10-27 19:41 +0100
    Re: Regular expression question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-28 04:12 +0200

csiph-web