[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnu-arch-users] Preventing matches in regular expressions
From: |
Andrew Suffield |
Subject: |
Re: [Gnu-arch-users] Preventing matches in regular expressions |
Date: |
Tue, 10 Aug 2004 20:42:25 +0100 |
User-agent: |
Mutt/1.5.6+20040722i |
On Mon, Aug 09, 2004 at 03:29:53PM -0400, Aaron Bentley wrote:
> That would add or update the regexes in the .arch-inventory. But since
> backup is tried before unrecognized, the rule for backup must match
> every zip file except 'fox.zip'
>
> Here's what I've finally come up with, using the example 'fox.zip':
>
> backup ^(.{0,2}|.{4}.*|[^f]..|.[^o].|..[^x])\.zip$
Yes, that's right. It's an old and rather evil trick.
> But man, oh man, that's an ugly regex, and it'll only get less readable
> with longer filenames and multiple filenames.
>
> Does anyone know a better general solution?
Well, you can implement regexp extensions that construct these
things. They can get a bit memory-hungry though.
More normally you just step outside the bounds of regexps though. Perl
does it by having regexps that aren't; perlre cannot be expressed as
an NFA, although it still uses one to do *most* of the work.
--
.''`. ** Debian GNU/Linux ** | Andrew Suffield
: :' : http://www.debian.org/ |
`. `' |
`- -><- |
signature.asc
Description: Digital signature
Re: [Gnu-arch-users] Preventing matches in regular expressions, Tom Lord, 2004/08/11