RegExp.match

12 views
Skip to first unread message

Dmitry Trunikov

unread,
Jan 20, 2012, 8:06:43 AM1/20/12
to Prototype & script.aculo.us
Hi ALL!
how can i obtain of matched substrings in RegExp object?
the prototypejs masks original RegExp.match method.
the original method returns array of matched strings. the new method
just returns true/false only.

thanks.

T.J. Crowder

unread,
Jan 20, 2012, 10:15:43 AM1/20/12
to Prototype & script.aculo.us
Hi,
The JavaScript RegExp object doesn't have a `match` method at all
(neither on `RegExp` nor on its prototype[1]). You're thinking of
either `RegExp#exec`[2] or `String#match`[3].

[1]: http://es5.github.com/#x15.10
[2]: http://es5.github.com/#x15.10.6.2
[3]: http://es5.github.com/#x15.5.4.10

HTH,
--
T.J. Crowder
Independent Software Engineer
tj / crowder software / com
www / crowder software / com

Dmitry Trunikov

unread,
Jan 22, 2012, 3:54:33 AM1/22/12
to Prototype & script.aculo.us
Hi Crowder,

Thank you very match. You are completely right. RegExp.exec is
suitable for me.

T.J. Crowder

unread,
Jan 22, 2012, 5:36:01 AM1/22/12
to Prototype & script.aculo.us
On Jan 22, 8:54 am, Dmitry Trunikov <dmitry.truni...@gmail.com> wrote:
> ...
> Thank you very match.
> ^
> ...

LOL No worries!

-- T.J. :-)
Reply all
Reply to author
Forward
0 new messages