[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 ''
> Here's what I've finally come up with, using the example '':
> 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
 : :' : |
 `. `'                          |
   `-             -><-          |

Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]