procmail
[Top] [All Lists]

A couple RE basics (was Re: Procmail Rules)

2001-01-05 12:48:55
On Fri, Jan 05, 2001 at 11:25:08AM -0500, Robert Dege 
(rcd(_at_)amherst(_dot_)com) said:
I didn't know that the '.' was not taken literally.  I left the '*' in
the @*test.com because certain people use their linux boxes as their
smtp server.  Else, (I thought) that the rule would reject a From:
prompt with something like @goku.test1.com.

* doesn't do what you seem to think it does.

The * in filename globbing (what lets you do stuff like "ls *.jpg" and
whatnot) is different than the * in regular expressions.  * in REs
matches zero or more of the previous character (well, not exactly;
zero or more of the preceding simple RE actually, but good enough for
now).  So @*test.com will match:

test.com
@test.com
@@test.com
[...]
@@@@@@@@@@@@@@@@@test.com

and so on, which I doubt is what you want.  . matches any character,
so .* does what you are expecting * to do (which is why you have to
escape .'s that you expect to be .'s).

You might want to check out the manual page for regexp  ("man regexp")
if that page exists on your system, or perhaps egrep or ed (searching
down to REGULAR in either case) if it doesn't.

-- 
Jim Toth
jjtoth(_at_)vcu(_dot_)edu
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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