Hi,
* Christian Lerrahn wrote (2006-04-03 16:32):
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.
Well, this is example *will* match certain mails, but I think it's a
bad one for the reasons just demonstrated.
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.
It shouldn't, I just made it ungreedy because it's cheaper.
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.
Do that. You do have a decent test environment, don't you? It takes a
few minutes to set it up, but you can run your own examples and don't
risk your mails.
Thorsten