Re: Help with a regular expression

Paul Randall wrote:

I'm not sure whether this interpretation correctly handles the ?: in
the regular expression -- I don't know what those two characters do
They stop the parentheses from creating a submatch when the regular
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.


We have just enough religion to make us hate but not enough to make us
love one another. -Jonathan Swift