procmail
[Top] [All Lists]

Re: Question on $MATCH

2002-08-25 23:48:07
in message <20020824131425(_dot_)GA862(_at_)pop(_dot_)gmx(_dot_)net>,
wrote Holger Wahlen thusly...

To determine a folder name from a bracketed word in the subject line,
parv recommended:

:0
* ^Subject:[        ]*\[\/[^]]\]
{
  :0:
  * MATCH  ??  ()[^]]
  IN-${MATCH}
}

in the "* Subject:", first $MATCH is set to text matched by
"[^]]\]".  later, the last ']' is removed by matching only "[^]]".

You'd have to use \/ for that again, I guess you just forgot.
[ snippet is replied later ]
Oh yeah, and the bracketed word is likely to have more than just
one letter:

oh crap! i missed it big time; thanks for catching.


But why include the closing bracket ... in MATCH at all? Simply
omit it in the first line already.

for the same reason one may want to use '[a-z0-9]+' instead of
'[^]]+': to exert control on the text being matched.

first time, i started my above recipe w/ correct regex & '\/'; then
i changed to your above proposed solution (did away w/ 2d MATCH).
being cautious that i am, i reverted but forgot to update the
recipe in between the changes. (not too cautious, hunh?)


to repent, below is the corrected moderately cautious version...


:0
* ^Subject:[    ]*\[\/[^]]+\]
{
  :0:
  * MATCH  ??  ()\/[^]]+
  IN-${MATCH}
}


....and this one is the short version as suggested by holger (which
i didn't & don't like)...


:0
* ^Subject:[    ]*\[\/[^]]+
IN-${MATCH}


...oh, there is one space & a tab inside '[]' after 'Subject:'.


  - parv

-- 

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

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