procmail
[Top] [All Lists]

Re: ?s about the "^^" regexp

1997-09-16 19:50:44
Simeon Nevel asked,

| What, exactly, does "Anchor the expression at the very start of the
| search area..." mean when applied to "B" flag tests?

Technically, an opening ^^ anchors to the putative newline that procmail sees
before the first character of the search area (and a closing ^^ anchors to
the putative newline that procmail sees after the end of the search area). 
When the search area is B, that is a point equivalent to the second of the
two adjacent newlines that enclose the empty line that marks the end of the
head.

The reason I'm bringing that up is this: if there are multiple empty or blank
lines between the head and the body, ^^ will mark the start of the second of
those lines, not the start of the first line of the body that contains some
text.

So if you want to test whether <pattern> is the first printing text in the
body, even if it is not necessarily flush left on the very first line, you
might need a condition like this:

 * B ?? ^^( |   |$)*<pattern>

The parentheses enclose space/pipe/tab/pipe/dollar.

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