[Box Backup] Confusion with Regex

Chris Wilson boxbackup@fluffy.co.uk
Sat, 10 May 2008 22:06:53 +0200 (CAT)


Hi Tobias,

On Sat, 10 May 2008, Tobias Roth wrote:

> I'm confused about the usage of regular expressions in the Exclude 
> lines. The website says to look at re_format(7) and mentiones this 
> example:
>
> ExcludeFilesRegex = *.(mp3|MP3)\$
>
> But according to re_format(7), this is not a valid regular expression, 
> because the * needs to be preceeded by an atom (also, why is the $ sign 
> escaped? If it signifies end-of-line, it shouldn't be). And boxbackup 
> confirms this, I get an error if I use:
>
> ExcludeFilesRegex = *

I think you're right, the documentation is in a bit of a state regarding 
regular expressions, particularly because on some platforms you only get 
POSIX and on some you get PCRE, which is more powerful, and there's no 
easy way to tell which you have got in your build, and we're waiting until 
we've fixed that before rewriting the docs.

> Now, I would like to do something else: Include all files except those 
> with a filename beginning with a dot.
>
> How would the exclude line look for that? ExcludeFilesRegex = ^\..* 
> doesn't seem to work, it still includes all hidden files.

It has to match the full path if you start with ^, therefore this would 
not match anything at all, since all paths start with / on Unix and a 
drive letter on Windows. You probably want something like this:

   ExcludeFilesRegex = /\.

Cheers, Chris.
-- 
_ ___ __     _
  / __/ / ,__(_)_  | Chris Wilson <0000 at qwirx.com> - Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer |
\ _/_/_/_//_/___/ | We are GNU-free your mind-and your software |