* Bill McCarthy <[EMAIL PROTECTED]> writes:

> The filter found in The Bat! Library does not function as
> "advertised."  The problem is in the export template.  The following
> macro was tested with all 21 possible locations of multi-line
> In-Reply-To and References lines (since I don't know the official
> rules as to where these must be).

I didn't do that much tests, but I think you can shorten this QT a bit.

 > --8<---------------cut here---------------start------------->8---
 > %SetPattRegExp="(?ismx)
 > (?:
 >   (?:
 >     (.*?)                          # SubPatt 1
1>     (?:
1>       ^In-Reply-To: | ^References:
1>     )
1>     .*?\n(?:\s.*?\n)*
X>     (.*?)                          # SubPatt 2
2>     (?:
2>       ^In-Reply-To: | ^References:
2>     )
2>     .*?\n(?:\s.*?\n)*
X>     (.*?)                          # SubPatt 3
 >   )
 >   |
 >   (?:
 >     (.*?)                          # SubPatt 4
3>     (?:
3>       ^In-Reply-To: | ^References:
3>     )
3>     .*?\n(?:\s.*?\n)*
X>     (.*?)                          # SubPatt 5
 >   )
 >   |
X>   (.*?)                            # SubPatt 6
 > )
 [...]
 > --8<---------------cut here---------------end--------------->8---

There are three equal parts (1, 2, 3) that match an IRT or Refereces
header. Each followed by an "(.*?)" (X). You first check for the
existance of both headers, then for only 1 or none.

--8<---------------cut here---------------start------------->8---
%SetPattRegExp="(?ismx)
(?:
  (?:
    (.*?)                          # SubPatt 1
    (?:
      (?:
        ^In-Reply-To: | ^References:
      )
      .*?\n(?:\s.*?\n)*
      (.*?)                        # SubPatt 2
    ){0,2}  #  <- !!!
  )
)
\n+\z"%-
%RegExpBlindMatch="%Headers"%-
%SubPatt="1"%SubPatt="2"
In-Reply-To: %ClipBoard

%Text%-
--8<---------------cut here---------------end--------------->8---

Again, this is not fully tested, but I think it is just a shorter
version of your pattern. And I hope it works as good as yours.

> Please let me know if you see any improvements or problems I've
> overlooked.

I didn't see any problems (maybe the \n\n should be a \n+, but I
don't know). Actually I'm not even sure if this shorter version is
an improvement.
-- 
Carsten


________________________________________________________

http://www.silverstones.com/thebat/TBUDLInfo.html

Reply via email to