By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,466 Members | 1,136 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,466 IT Pros & Developers. It's quick & easy.

regular express, capture fields with ()

P: n/a
Know perl? What's the analog for this /string(\d{1,2})/ I can't get
anything to spin up.

And, once this is running, is only the last match available with
RegExp.lastParen?

string.match(/string(\d{1,2}); no go

Thanks.
Sep 12 '08 #1
Share this Question
Share on Google+
6 Replies


P: n/a
oldyork90 wrote on 12 sep 2008 in comp.lang.javascript:
Know perl? What's the analog for this /string(\d{1,2})/ I can't get
anything to spin up.

And, once this is running, is only the last match available with
RegExp.lastParen?

string.match(/string(\d{1,2}); no go
Do you have a javascript Q?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Sep 12 '08 #2

P: n/a
On Sep 12, 3:09 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
oldyork90 wrote on 12 sep 2008 in comp.lang.javascript:
Know perl? What's the analog for this /string(\d{1,2})/ I can't get
anything to spin up.
And, once this is running, is only the last match available with
RegExp.lastParen?
string.match(/string(\d{1,2}); no go

Do you have a javascript Q?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
so, I take it string.match(/string(\d{1,2}); should work. Ok, I work
it. It has to be close.
Sep 12 '08 #3

P: n/a
oldyork90 <ol*******@yahoo.comwrites:
Know perl? What's the analog for this /string(\d{1,2})/ I can't get
anything to spin up.
jsvar r = "string1234".match(/string(\d{1,2})/)
jsr[1]
12
And, once this is running, is only the last match available with
RegExp.lastParen?
Erm. Yes? What else?
>
string.match(/string(\d{1,2}); no go
How do you figure?

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Sep 12 '08 #4

P: n/a
oldyork90 wrote on 12 sep 2008 in comp.lang.javascript:
On Sep 12, 3:09 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
>oldyork90 wrote on 12 sep 2008 in comp.lang.javascript:
Know perl? What's the analog for this /string(\d{1,2})/ I can't get
anything to spin up.
And, once this is running, is only the last match available with
RegExp.lastParen?
string.match(/string(\d{1,2}); no go

Do you have a javascript Q?
[please do not quote signatures on usenet]
so, I take it string.match(/string(\d{1,2}); should work. Ok, I work
it. It has to be close.
You work what? Perl?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Sep 13 '08 #5

P: n/a
oldyork90 wrote:
string.match(/string(\d{1,2}); no go
^ ^
You forgot to "close" the RegExp literal. Use the script console or a
debugger before you complain next time.

<http://jibbering.com/faq/>
PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
Sep 13 '08 #6

P: n/a
On Sep 13, 1:33 pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
oldyork90 wrote:
string.match(/string(\d{1,2}); no go

^ ^
You forgot to "close" the RegExp literal. Use the script console or a
debugger before you complain next time.

<http://jibbering.com/faq/>

PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
That was just a typo. Turned out to be apache/cgi.
Sep 15 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.