procmail
[Top] [All Lists]

Re: How do I extract subject?

2000-03-15 09:31:13
John Summerfield <summer(_at_)OS2(_dot_)ami(_dot_)com(_dot_)au> writes:

    If the subject is the name of the file and nothing else, try this:

     :0 bw
     * (conditions)
     * ^Subject:[    ]+\/.*

It's not necessary to have white space after the colon, so

      * ^Subject:[    ]*\/.*


Because of procmail's combination of minimal and maximal matching, those
conditions will not exclude all the whitespace they can.  If you want to
force the extracted text to start with a non-whitespace characters, you
must explicitly do so:

        * ^Subject:[    ]*\/[^  ].*

If you want to extract just the first string of non-whitespace
characters, that would be:

        * ^Subject:[    ]*\/[^  ]+


Note that
        * ^Subject:[    ]*\/[^  ]*

will *not* work, and will in general extract *nothing* into MATCH.


If you want to match the entire subject except for both leading and
trailing whitespace, you need to use:

        * ^Subject:[    ]*\/[^  ](.*[^  ])?


Philip Guenther

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