procmail
[Top] [All Lists]

Re: regex ending in an optional part

2004-11-26 16:49:38
On Fri, Nov 26, 2004 at 11:15:30PM +0100, Robert Allerstorfer wrote:

Ruud H.G. van Tol replied:

A regex ending in an optional part, is better without that optional
part.

But if you have the following condition:

 NL = "
" av_B64 = "A-Za-z0-9+/"

 :0 B D
  # [1]
  * $ $NL$NL\/UmFy([$av_B64]+$[^$NL-])+([$av_B64]+)?
  {
    # do something
  }

and you would strip the ending part ([$av_B64]+)? from the regex, thus
having

  # [2]
  * $ $NL$NL\/UmFy([$av_B64]+$[^$NL-])+

the match may then not be complete. You can try if in a mail
containing the following code in the body:

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.

-- 
dman

____________________________________________________________
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>