Re: match(regexp) deciphering
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: match(regexp) deciphering

From: Thomas 'PointedEars' Lahn <PointedEars@web.de>
Date: Tue Feb 28 2006 - 16:16:55 CET

Thomas 'PointedEars' Lahn wrote:

> brad wrote:
>> Hello all, I'm new to javascript--not too new to a few other
>> programming languages--and I need your help deciphering the Regexp in
>> the following string. Regular expresions are hard enough in Python, and
>> since I am new to javascript they are even harder. Well here's the
>> string, thanks for any and all help I receive.
>>
>> document.URL.match(/^(.+?)(?:\?(?:(.*?)@)?(.+))?$/)
>
> [...] and return a reference to an Array-like object (one including
> numerically iterable properties) with each match of a captured paranthesed
> subexpression being available as property of that object with numerical
> name, starting with "0" as the property name for the first captured match.
 
Sorry, that is nonsense. Should have been

... starting with "0" as the property name for the match of the whole
expression, "1" for the captured match of the first paranthesed
subexpression (here: /.+?/) and so on.
 

PointedEars
Received on Mon May 1 03:41:10 2006