On Mon, Oct 15, 2012 at 12:56:40PM +0800, Jason Heeris wrote:
> Okay, I managed to cheat a bit, so I'm sharing my workaround here. In
> my includes file, I used the form:
> 
>   /specs*01234*
> 
> ...and for the directories:
> 
>   /results/RST-0001 (v0.01) #001*
> 
> ...and now everything seems to be expunged that should be.
> 
> I have no idea why the original form doesn't work, maybe it's the "["
> characters or somesuch. Obviously you need to be a bit careful that
> your patterns aren't too general; in my case those five-digit numbers
> are a unique enough pattern to work for me.

The square brackets are wildcard syntax saying "match any of the characters
listed within the brackets". This is part of the syntax of the fnmatch()
standard C function, see:
http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_13_01

The pattern you originally tried to use:

   /specs/[01234]

would match any of the following paths:

   /specs/0
   /specs/1
   /specs/2
   /specs/3
   /specs/4

But not this path, assuming '[01234]' is a literal part of the filename:

  /specs/[01234] product x spec.pdf

The pattern you ended up using is a better way of matching those paths:

  /specs*01234*

You should be able to quote the square brackets with a backslash to prevent
them from causing wildcard matching. For instance, the following should
match '/specs/[01234] product x spec.pdf':

   /specs/\[01234\]*pdf

Reply via email to