procmail
[Top] [All Lists]

oops on regexp

1996-06-24 05:50:20
In my response to Timothy Luoma's question yesterday I used an incorrect
condition to check for something that looked like a header at the beginning
of the body.

The recipe should read as follows:

   :0Bfw # brackets enclose caret, space, tab
   * ^^($)*[^   ]+:
   | sed -e '/^$/,$!b' -e '/./,$!d'

The condition I originally gave had two errors: it assumed that there would
be only one spuriously inserted blank line above the rest of the headers,
and since I carelessly left out the plus sign it required the next header
line to have a one-character name.

It should be noted that the corrected condition can also be written this way:

   * ^^(^)*[^   ]+:

where the four carets have three different meanings, none of them denoting a
literal caret in the text.  Fun stuff, huh?

<Prev in Thread] Current Thread [Next in Thread>
  • oops on regexp, David W. Tamkin <=