procmail
[Top] [All Lists]

Re: Simple (for you) regexp question

1998-11-16 11:27:25
On Mon, 16 Nov 1998 18:48:38 +0200 (EET), Kimmo Jaskari
<kimmo(_at_)alcom(_dot_)aland(_dot_)fi> wrote:
Ok, I need to match a line that can basically start with anything
from one word to 6, but always ends the same way. Thus far I've been
using .* even though that for some reason is not the way to do it (yes,
when it comes to procmail recipes I'm of the steal, cut and paste school)

You mean like this?

    WORD="[a-z']+\\>+"
    :0:
    * $ ^$WORD($WORD($WORD($WORD($WORD($WORD)?)?)?)?)?\>+same thing as always
    action

This is untested. (For text in a Nordic language, you should probably
add some characters with nice diacritics to the WORD definition, and
perhaps even take out the apostrophe.)

What do you mean by "for some reason that is not the way to do it"?
Yes, generally speaking, .* is too prone to accidentally match
something you didn't intend it to, so if you want to match on
something more specific, you should spell it out. Is this what you are
referring to?

/* era */

-- 
.obBotBait: It shouldn't even matter whether    <http://www.iki.fi/~era/>
I am a resident of the state of Washington. <http://members.xoom.com/procmail/>

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