[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 23:14:14 CET

> The problem is with trying to match varying amounts of stuff between
> "issue" and the issue number. You, Stefan, and I have now all tried the
> same thing: match the word "Issue", followed maybe by some junk spacing
> or pound signs or other issue numbers, and then return the issue number
> at the end. The problem is that neither GRETA, nor Perl, nor any other
> regex engine will behave that way when given either a greedy or
> non-greedy "+" or "*".
>
> The problem isn't whether a group can return more than one result if it
> matches more than one time; it can. If we just use the regex of (\d+)+
> then it will match every issue number and return them correctly. But
> that's too much; we don't want to match every number in the log message,
> just ones that look like they're actually referring to an issue number.
>
> To explain it another way, the reason the former doesn't work is that
> any given part of the string being searched can be matched only once. We
> are attempting to match the word "Issue", followed by some stuff we
> don't care about, followed by some stuff we do care about, multiple
> times. Regex parsers don't work that way; they find the shortest portion
> of the string that matches, they return that result, and if you
> specified GLOBAL, they keep going. You can't go back to the same part of
> the string twice. That's why two passes are necessary: one pass to strip
> out the interesting parts, and another pass to strip out only the
> numbers from those parts.

Well, I wouldn't say all regex engines, since I am able to successfully
parse out every single issue number in the .NET regex engine just fine using
my regex and a single pass. If GRETA does not support doing so, then I
guess we have to go to a two pass solution, but I haven't given up just yet
because I think the two pass solution is ugly and inefficient. :-)

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 23:18:50 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.