procmail
[Top] [All Lists]

Re: regexp question(s)

1998-07-01 14:17:14

On Wed, 01 Jul 98 12:24:43 -0500, Jim Murphy 
<murphyja(_at_)cig(_dot_)mot(_dot_)com> wrote:
I'm no expert on regular ecpressions, but I'm trying to come to grips with
what can or can't be done with them in procmail.  
...
 So using the man
pages from several operating systems as a guide I've tried to write a
recipe to find lines like:

      Subject: AB000000055449 etc...
      Subject: XYZ155449 etc...
      Subject: something... XYZ155449 etc...


Jim,

So what _exactly_ are you trying to match against?  The 3 examples you 
provided don't necessarily give enough information.

My guess is that you want to match exactly 6 digits as long as they are 
contained in a particular pattern that might have a few variations (the ABxxx 
and XYZxxx you mentioned).  (If this is not what you intended, the rest of 
this response will be rather pointless...)

If this is what you wanted, just spell out what you want explicitly; ie.

        * ^Subject:.*(AB|XYZ)[0-9][0-9][0-9][0-9][0-9][0-9]

Wordy?  Yes.  Is there a "better" way to do it?  Probably - there usually is 
with regexps.  But in my opinion, the best way to _start_ working on a given 
regexp is to specify it in long form exactly the way you would say it and go 
back later to "tune" it if you want to.

Hope this helps you get going.


-- 
Mark Scarborough
System Administrator
University of Texas, Austin
Texas Education Network (TENET)               (That's TEN-it, not TEE-net.)
mscar(_at_)tenet(_dot_)edu   (MarkScar(_at_)usa(_dot_)net)
(Shameless plug... Currently looking for a Unix SysAdmin job in Austin, TX)



<Prev in Thread] Current Thread [Next in Thread>