Re: Help with a regular expression
- From: "Steve" <cerberus40@xxxxxxxxxxx>
- Date: Wed, 1 Oct 2008 06:29:13 -0400
Paul Randall wrote:
They stop the parentheses from creating a submatch when the regular
I'm not sure whether this interpretation correctly handles the ?: in
the regular expression -- I don't know what those two characters do
here.
expression is executed. Any time you use parentheses in a pattern and
don't use the Submatches collection (or don't use all the members of the
collection) you should use (?: ) to group any submatch you're not
interested in.
I'm not sure about the .NET regexp engine, but the VBScript engine does
not degrade well for complex patterns. When a pattern crosses the
tipping point, the engine "hits the wall" and slows to a crawl. Anything
you can do to cut down the work the engine needs to do and moves the
wall a little further back.
I don't know if the VBScript regexp's Test method is optimized, but I
suspect that it just calls the same code as the Execute method and tests
the Count property of the returned Matches collection.
And in this case, a submatch is not very useful--it would only capture
the last group of comma and digits and ignore any preceeding ones.
--
Steve
We have just enough religion to make us hate but not enough to make us
love one another. -Jonathan Swift
.
- Prev by Date: Script producing ""Not enough storage is available to complete..."
- Next by Date: Re: Help with a regular expression
- Previous by thread: Script producing ""Not enough storage is available to complete..."
- Next by thread: Re: Help with a regular expression
- Index(es):
Relevant Pages
|