Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #7755
| Message-ID | <1326734.ds2RrIXCgJ@PointedEars.de> (permalink) |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Organization | PointedEars Software (PES) |
| Date | 2011-10-28 04:12 +0200 |
| Subject | Re: Regular expression question |
| Newsgroups | comp.lang.javascript |
| References | <a9fa509f-5f3c-4926-abc6-c77a21427d8f@j36g2000prh.googlegroups.com> <VZn6PnGMXaqOFwQs@invalid.uk.co.demon.merlyn.invalid> |
| Followup-To | comp.lang.javascript |
Followups directed to: comp.lang.javascript
Dr J R Stockton wrote:
> <ron.eggler@gmail.com> posted:
>> First thing, I'm a regular expression newbie.... somewhat anyways...
>> I would like to recognize the difference between this url:
>> http://quaaoutlodge.com/site/the-lodge/our-history.html
>> and that url:
>> http://quaaoutlodge.com/site/the-lodge.html
>> and at the same time extract the document name (our-history or the-
>> lodge) and the directory name if present (the-lodge).
>> I got stuck at how rto rcognize the second directory instead of the
>> first (the-lodge/ instead of site/) with "\b\/[a-z]+\/" how do i get
>> the second one only?
>
> The easiest way, teaching nothing about RegExps, should be to use the
> string method 'split' with an argument "/", and contemplate the result
> and its length.
By contrast, that requires accessing the `length' property of the resulting
array, too, and is inflexible with regard to potential query and fragment
parts.
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll 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