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
here.
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.

--
Steve

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


.



Relevant Pages

  • Re: Need help to split a string into text and numeric values !!
    ... There are many flavors of Regular Expression engines, ... (any character) ... The interpretations above are how the dot net RE engine would execute the ... I have found only one free RE interpreter, ...
    (microsoft.public.scripting.vbscript)
  • Re: Whats wrong with Tcl greediness?
    ... Its presence causes the _whole_ regular expression ... to be non-greedy (a consequence of the regular expression ... engine that is used, ...
    (comp.lang.tcl)
  • Re: Which Regex-Engine will be used in Ruby 1.8.3 Release?
    ... > * no one have verified regular expression compatibility in detail before. ... > * no one have proven the stability of the new engine. ... but without regular access to the internet. ... transfer the data somehow via internet to ...
    (comp.lang.ruby)
  • Re: Ruby regexp spec. (was: OT: Regexp buddy)
    ... comprehensive list of just what syntax ruby's regular expression ... that shows that ruby's regexp engine supports perl's "don't ... but that it does not support the ... in irb and see what happens, but it'd be nice if the documentation ...
    (comp.lang.ruby)
  • Ruby regexp spec. (was: OT: Regexp buddy)
    ... Speaking of learning regexps for ruby, ... comprehensive list of just what syntax ruby's regular expression ... that shows that ruby's regexp engine supports perl's "don't ... but that it does not support the ...
    (comp.lang.ruby)