[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [TSVN] regex help

From: SteveKing <steveking_at_gmx.ch>
Date: 2005-02-17 20:31:16 CET

Toby Johnson wrote:

> The second half of the text to match is returning only two values
> because you have two grouping parentheses which return values. It's not
> returning a particular match twice, it's returning two matches once, if
> that makes sense.
>
> The problem here is that a plus sign is greedy -- it will gobble up
> everything it can until there are no more matches. The alternative is +?
> which matches as little as possible. There's no between-ground to say
> "match this as many times as possible". And using a GLOBAL replace won't
> work, because it would keep matching the same issue number instead of
> each one consecutively.

Thanks for the explanation. So basically, it returns only as many groups
as the regex string contains, not as many groups as the regex string got
repeated. Bad, bad ;)

> In short, I can't think of any way to accomplish what you're trying to
> do without using two passes:
> Pass 1 (NOCASE): ((?:issue)[\d\s#,]+)
> Pass 2 (fed the results from pass 1): (\d+)

It's a good thing then that we keep the existing specs for the issue
tracker integration with the two regex strings and just add the new one
with the groups to the existing specs as an alternative.

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Thu Feb 17 20:33:41 2005

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.