procmail
[Top] [All Lists]

Re: What does the condition "* ^^($)|$$$" match ?

1999-10-15 10:41:19
Aaron Digulla saw this,

|       ^^($)|$$$

and wanted to know,

| It matches an empty line at the beginning of the body (B flag
| and "^^($)") or something else. What does "$$$" mean ?

It means three newlines in a row -- in other words, two empty lines in a row.
Perhaps $($)$ would have been easier to read.

If the body begins with an empty line, or if there are two empty lines in a
row, the text can be squeezed: any initial empty lines removed, and any runs
of two or more empty lines reduced to a single empty line.  That was the
purpose of the recipe.

| Also, what is the difference between "^" and "$" in a
| regexp ? Are they exactly the same because of procmails'
| multiline matching ?

Not exactly.  ^^ at the beginning or end of the regexp anchors to the
putative newline at the start or end of the search area.  Also, if the
recipe has the $ modifier, $ can introduce the name of a variable to
be expanded, depending on whether the next character is legal as the first
character in a variable.  Otherwise, they're pretty much the same.

It should be noted that \$ means a dollar sign if there is no $ modifier on
the condition but a newline if there is one.  [$] always matches a dollar
sign and ($) always matches a newline, whether the condition has the $
modifier or not.

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