473,702 Members | 2,325 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

regular express, capture fields with ()

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.lastPare n?

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

Thanks.
Sep 12 '08 #1
6 916
oldyork90 wrote on 12 sep 2008 in comp.lang.javas cript:
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.lastPare n?

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
On Sep 12, 3:09 pm, "Evertjan." <exjxw.hannivo. ..@interxnl.net wrote:
oldyork90 wrote on 12 sep 2008 in comp.lang.javas cript:
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.lastPare n?
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
oldyork90 <ol*******@yaho o.comwrites:
Know perl? What's the analog for this /string(\d{1,2})/ I can't get
anything to spin up.
jsvar r = "string1234".ma tch(/string(\d{1,2})/)
jsr[1]
12
And, once this is running, is only the last match available with
RegExp.lastPare n?
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
oldyork90 wrote on 12 sep 2008 in comp.lang.javas cript:
On Sep 12, 3:09 pm, "Evertjan." <exjxw.hannivo. ..@interxnl.net wrote:
>oldyork90 wrote on 12 sep 2008 in comp.lang.javas cript:
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.lastPare n?
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
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
On Sep 13, 1:33 pm, Thomas 'PointedEars' Lahn <PointedE...@we b.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
3180
by: Tina Li | last post by:
Hello, I've been struggling with a regular expression for parsing XML files, which keeps giving the run time error "maximum recursion limit exceeded". Here is the pattern string: r'<code>(?P<c>.*?)</code>.*?<targetSeq name="(?P<tn>.*?)">.*?<target>(?P<t>.*?)</target>.*?<align>(?P<a>.*?)</align>.*?<template>(?P<temp>.*?)</template>.*?<an otherTag>(?P<at>.*?)</anotherTag>.*?<yetAnotherTag>(?P<yat>.*?)</yetAnotherTag>' The file format...
4
3223
by: Neri | last post by:
Some document processing program I write has to deal with documents that have headers and footers that are unnecessary for the main processing part. Therefore, I'm using a regular expression to go over each document, find out if it contains a header and/or a footer and extract only the main content part. The headers and the footers have no specific format and I have to detect and remove them using a list of strings that may appear as...
3
1450
by: | last post by:
Hi I need to write one regex to read all the fields from the following lines / file format line 1 - some_alphanumeric,some_alphanumeric,"something, something",numbers_hyphenatedORnot line 2 - some_alphanumeric,some_alphanumeric,something something,numbers_hyphenatedORnot At first I thought this one will do
2
2047
by: norton | last post by:
Hi, I am learning Regular Expression and currently i am trying to capture information from web page. I wrote the following code to capture the ID as well as the Title Dim regex = New Regex( _ "viewtopic.php\?t=(?<ID>\d+)""\sclass=""topictitle"">(?<Title>.*)\</a>", _ RegexOptions.IgnoreCase _
5
2282
by: Cylix | last post by:
I am going to write a function that the search engine done. in search engine, we may using double quotation to specify a pharse like "I love you", How can I using regular expression to sperate each pharse? test case: "I love" all "of you" I would like it return:
3
1887
by: Zach | last post by:
Say I have a string which is of the format {A, B, C, D} for some variable number of objects. I want a regular expression that will put each of A, B, C, and D into its own separate capture group without any commas. If the string is {}
7
1267
by: McHenry | last post by:
I would like a regex for the following html snippet: <h2>Field1</h2> <h3> $123,456.78 - $987,654.32 </h3>
3
2547
by: Chris | last post by:
Hi everyone, I'm trying to parse through the contents of some text files with regular expressions, but am new to regular expressions and how to use them in VB.net. I'm pretty sure that the regular expressions are correct as I got them from regexlib.com and tested them in the Regulator and Expresso. The problem is I tested this function with a file that contains a string
5
3788
by: shawnmkramer | last post by:
Anyone every heard of the Regex.IsMatch and Regex.Match methods just hanging and eventually getting a message "Requested Service not found"? I have the following pattern: ^(?<OrgCity>(+)+), City of, (?<OrgState>(()|( +\.)))( \((?<OrgCountry>{2,})\))?$ (ignore the line wrap)
4
2119
by: mosesdinakaran | last post by:
Can any one explain how the rule is applied for the following Regular expression $Str = 'the red king'; $Pattern = '/((red|white) (king|queen))/'; preg_match($Pattern,$Str,$Val); Result:
0
8739
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8652
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9234
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8983
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8940
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5907
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2402
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2036
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.