[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: Eric J. Smith <eric_at_ericjsmith.net>
Date: 2005-02-17 22:38:17 CET

> Capturing is not the problem here! It's the returned groups! Since
> groups are numbered from 0 to X with 0 being the whole match and the 1
> being the first group, 2 being the second this will only return the
> first bug ID in group 1.

Hrmm... when I run the regex with your tester, it seems to only report the
very last issue number from each match. Is that what it's doing for you as
well because it sounds like your saying that it's only returning the very
first issue number for each match.

Are you sure that you are somehow not enumerating through all of the groups
properly or something? I wish I was a C++ guy and I could test it on my end
for you, but I am not unfortunately.

Assuming that we can get this working, here is another updated version that
supports even more variants:

(?:[Ii]ssues?|[Ff]ixe[ds]|[Cc]orrect(?:s|ed)):?(?:(?:,\s*|\s*,?\s+[Aa]nd\s+|
\s+)\#?(\d+))+

It captures all of these variants:
issue: 1
issue #2
Issues #3,4,5
Issue 6 and 7
Issues #8,9, #10, #11 , and #12
fixes #13
fixed 14
Fixed #15, #16, and #17
Corrected #18 and #19
Corrects #20 and #21

One interesting note is that when I test this with the .NET regex engine
(using the awesome Regular Expression Workbench tool), this is the output
that I get from it:

Matching: issue: 1
issues #2
Issue #3,4,5
Issue 6 and 7
Issue #8,9, #10, #11 , and #12
fixes #13
fixed 14
Fixed #15, #16, and #17
Corrected #18 and #19
Corrects #20 and #21
    0 => issue: 1
    1 => 1
    0 => issues #2
    1 => 2
    0 => Issue #3,4,5
    1 => 3
    1 => 4
    1 => 5
    0 => Issue 6 and 7
    1 => 6
    1 => 7
    0 => Issue #8,9, #10, #11 , and #12
    1 => 8
    1 => 9
    1 => 10
    1 => 11
    1 => 12
    0 => fixes #13
    1 => 13
    0 => fixed 14
    1 => 14
    0 => Fixed #15, #16, and #17
    1 => 15
    1 => 16
    1 => 17
    0 => Corrected #18 and #19
    1 => 18
    1 => 19
    0 => Corrects #20 and #21
    1 => 20
    1 => 21

So it does capture every single issue number, but the interesting part is
that when there are multiple issues in a single match, it labels every one
of them as group 1. I would hope that GRETA will provide you access to all
of these groups as well. Maybe there is just some trick to enumerating
them?

Eric J. Smith

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Thu Feb 17 22:41:49 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.