On Thu, 5 Jun 2003, Joel Heenan wrote:
> Date: Thu, 5 Jun 2003 16:13:59 +1000
> From: Joel Heenan <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: [SLUG] RE: IMAP and procmail (Regular Expression Question)
>
> > * ^((List-Id|X-(Mailing-)?List):(.*[<]\/[^>]*))
>
> My understanding of this regular expression. Indulge me:
>
> Message must begin with either List-Id or X-(Mailing-)List where the
> Mailing- part is optional.
Assuming we are ignoring everything before the ^, then so far so good.
> It must then be followed by a colon
Yep
>then anything up to a </ then anything up to another >
Not. quite. This will match zero or more characters which are not '>'
after the '</'. There may not be an '<'. I'm not familiar with the
context, but this last bit may match across multiple lines. the '.*'
however won't match line breaks.
>
> So help me out a bit, I copied the line from Slug into a file and egrep did
> not match slug's List-Id line!
>
> List-Id: Linux and Free Software Discussion <slug.slug.org.au>
>
> Why is the / in there? Why is the < in brackets what purpose does this
> serve?
the [<] bit is redundant, but depending on the flavour of regex, you may
need to use '\<' so that you don't match a word beginning instead of a
literal '<'. the '/' looks to be the problem that's stumping you. I'd
probably insist on the closing '<' as well, but it may be un-necessary
pedantry.
Andrew
--
No added Sugar. Not tested on animals. If irritation occurs,
discontinue use.
-------------------------------------------------------------------
Andrew McNaughton In Sydney
Working on a Product Recommender System
[EMAIL PROTECTED]
Mobile: +61 422 753 792 http://staff.scoop.co.nz/andrew/cv.doc
--
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug