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

Re: Regular expressions in Subversion

From: Stefan Sperling <stsp_at_elego.de>
Date: Wed, 17 Oct 2012 20:17:06 +0200

On Wed, Oct 17, 2012 at 12:20:20PM -0400, Hyrum K Wright wrote:
> There are several places where regular expressions would be useful in
> Subversion. Off hand, the new log --search feature and svn:ignore
> properties feel like they'd be use candidates for regexs, and they
> could probably also apply to authz rules eventually. I'm sure there
> are more.

How do we change existing features from glob syntax to regex without
breaking compatibility? A glob pattern can of course be expressed in
regex syntax, but the syntax isn't equivalent. Can we reliably detect
whether a given pattern (say, on a line within svn:ignore) is a glob
pattern or a regex?

For instance, what about "a*.txt"? In glob this means: starts with 'a',
followed by any amount of characters, and ends with '.txt'. But in regex
it means: starts with any number of 'a' characters (including zero), and
ends with '.txt'.

$ ls *.txt | egrep 'a*.txt'
a.txt
aaa.txt
bbb.txt
foo.txt
$ ls a*.txt | egrep 'a*.txt'
a.txt
aaa.txt
$

(where ls uses glob syntax and egrep uses regex)
Received on 2012-10-17 20:17:44 CEST

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

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