procmail
[Top] [All Lists]

Re: test variable value

2001-02-26 08:41:55
On 26 Feb, David W. Tamkin wrote:
| Don Hammond followed up,
| 
|| So returning to my question, there is a functional difference between:
|| 
|| * var ?? ^^regexp^^
|| 
|| and
|| 
|| * var ?? ^regexp$
|| 
|| but only if var contains a value with multiple [new]lines. Right?
| 
| Ooh gosh.  If you want a short, oversimplified answer, wait for someone else
| to respond.

No, you misunderstood. I was only limiting my own innate verbosity. Not
intending to do the same to anyone else. ;-)

| If there can be no embedded newlines in the value of the variable and there
| are none in the regexp either, then those are equivalent.  Thing is, unlike
| egrep, procmail allows embedded newlines inside regexps.  So let's put it
| this way: there's a functional difference only if the value of the variable
| can cover more lines than the regexp does.  In that case, the value of the
| variable often ends in a real newline, and a closing ^^ will match only the
| putative newline, so the condition will need to look something like
| 
|   multilinevar ?? ^^regexp($)^^
| 
| to test whether the entire value of the variable is described by the regexp.

That explains it all perfectly. And I would have missed the nuance
between $, ^^, and ($)^^ in a multi-line variable without the
explanation.  Thanks.

Don Hammond



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