Skip Menu |

This queue is for tickets about the JE CPAN distribution.

Report information
The Basics
Id: 55405
Status: resolved
Priority: 0/
Queue: JE

People
Owner: Nobody in particular
Requestors: craig [...] animalhead.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: bug in JE 0.042: no implicit .exec on regexp
Date: Tue, 9 Mar 2010 20:22:37 -0800
To: bug-JE [...] rt.cpan.org
From: craig [...] animalhead.com
The ancient ClientReferenceJS13.pdf defines the exec method of a regexp as follows: --------------- exec Executes the search for a match in a specified string. Returns a result array. Syntax regexp.exec([str]) regexp([str]) Parameters regexp The name of the regular expression. It can be a variable name or a literal. str The string against which to match the regular expression. If omitted, the value of RegExp.input is used. Description As shown in the syntax description, a regular expression’s exec method can be called either directly, (with regexp.exec(str)) or indirectly (with regexp(str)). ---------------- Under JE 0.042, perl 5.10.1, FreeBSD 6.3 the following statement var test = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/(ipaddr); threw the following error: DB<194> p $@ Can't locate object method "call" via package "JE::Object::RegExp" at / usr/local/lib/perl5/site_perl/5.10.1/JE/Code.pm line 1274. Adding the explicit '.exec' made everything work well: var test = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3}) $/.exec(ipaddr);
On Tue Mar 09 23:23:51 2010, craig@animalhead.com wrote: Show quoted text
> The ancient ClientReferenceJS13.pdf defines the exec method of a > regexp as follows: > --------------- > exec > > Executes the search for a match in a specified string. Returns a > result array. > > Syntax regexp.exec([str]) > regexp([str])
In the eleven years I’ve been using JavaScript I’ve never noticed that. But, sure enough, the trusty old 1.2 reference I still use has it. Oddly enough, ECMAScript 3 makes no mention of it, nor does JScript support it; but SpiderMonkey, Nitro, V8 and ExtendScript do, so I suppose I’d better. ...time passes... Please try version 0.043.