| From | Sent On | Attachments |
|---|---|---|
| Christian Lerrahn | Mar 29, 2006 10:35 pm | |
| Thorsten Haude | Mar 30, 2006 4:22 am | |
| mouss | Mar 30, 2006 12:12 pm | |
| Christian Lerrahn | Mar 30, 2006 1:54 pm | |
| Thorsten Haude | Mar 30, 2006 4:35 pm | |
| Christian Lerrahn | Apr 2, 2006 11:33 pm | |
| Thorsten Haude | Apr 3, 2006 12:07 am | |
| Christian Lerrahn | Apr 3, 2006 6:37 am | |
| Thorsten Haude | Apr 3, 2006 12:09 pm | |
| Christian Lerrahn | Apr 20, 2006 4:47 am | |
| Devin Rubia | Apr 20, 2006 7:08 am | |
| Sam Varshavchik | Apr 20, 2006 3:57 pm |
| Subject: | Re: [maildropl] Problems with regular expressions | |
|---|---|---|
| From: | Christian Lerrahn (lis...@penpal4u.net) | |
| Date: | Apr 2, 2006 11:33:37 pm | |
| List: | net.sourceforge.lists.courier-maildrop | |
Hi Thorsten,
[snip]
Matching mail adresses is not trivial. Friedl has a regex for this in his book which is one solid page long. Others say it can't be done at all.
Why is that such a problem? It can be easily done in procmail.
What regex?
One of the reasons is that adresses have recursive elements, regexes don't. Also, things like ab...@def.com <xy...@axample.com> tend to be interesting.
Why are the examples in the maildrop documentation not working? At least one of the examples I gave was from the docs.
Which one?
man 7 maildropex gives the example
if (/^From: *boss@domain\.com/ \ && /^Subject:.*[:wbreak:]project status[:wbreak:]/) { cc "!john" to Mail/project }
This is essentially the same as what I tried, just that the . is escaped and there's a second rul.
Anyway, for the case you mention above, try /^From:.*?ab...@def.com$/.
Ok, I'll try that. But why does the .* have to be greedy?
It ain't. The ? makes it explicitly ungreedy. (I guess, I never actually used the later versions of Maildrop.)
In Perl you would only have to use greedy matching if there are several occurrences of what is behind that pattern. This is not the case here.
It should work either way in this case, but ungreedy pattern tend to be cheaper.
Sorry. I was only confusing the two things. Of course, this is ungreedy matching. However, greedy matching didn't seem to work and I have no clue why this should be about greedy or not.
And shouldn't it be /^From:.*?ab...@def.com.*?$/ then? Otherwise, the ">" at the end of the address would still be a problem wouldn't it?
True, just leave out the closing $.
Ok. I had guessed that. However, I haven't got it working so far. But I'll go on experimenting a bit.
Cheers, Christian
-- PGP key available at http://www.penpal4u.net/keys/Christian_Lerrahn.asc .





