procmail
[Top] [All Lists]

Re: regex ending in an optional part

2004-11-26 17:14:09
On Sat, 27 Nov 2004, 00:40 GMT+01 Dallman Ross wrote:

On Fri, Nov 26, 2004 at 11:15:30PM +0100, Robert Allerstorfer wrote:
[...]
  # [1]
  * $ $NL$NL\/UmFy([$av_B64]+$[^$NL-])+([$av_B64]+)?
[...]
  # [2]
  * $ $NL$NL\/UmFy([$av_B64]+$[^$NL-])+

Yes, but now you've introduced a match token, which is a special
case that is rightward-greedy instead of spare.  Since you want to
match the string if it's there -- for later decoding or whatever --
it makes sense to have an optional part there.

Yes, in fact I need the entire base64 string to decode it once it has
been catched. If a single character would miss from the match, the
entire decoding would fail. So the "optional" part not only "makes
sense" in my code, it is actually not even optional, but essentiell
instead. This also means it can be dangerous to generally think
procmail's regex engine is not greedy and therefore assume to never
use regex's that end with a (...)? part.

rob.
--



____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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