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)