Hello David,
On Monday, June 2, 2003 at 09:49 GMT -0400, an infinite number of
monkeys posting as David [D] typed:
D> No, what was happening is, if I had, say, three paragraphs separated
D> by blank lines, wrap2 and bqq were stripping the blank lines.
That shouldn't be happening, you should have one blank line between
each paragraph with the original wrap2 template. The one on the
website looks right, did you copy and paste it *exactly* as written
there? (ie, not deleting any blank lines or adding any %- macros)
D> Your new version of wrap2 is leaving the blank lines, but alas, it is
D> also causing weird multiple quotation:
Yeah, that would be because I miscounted the subpatterns. (I did warn
you I might be rusty.) See below for the fix.
=====[Begin modified wrap2]=====
%IF:'%-
%SETPATTREGEXP="(?is-m)[^\n]+"%-
%REGEXPMATCH="%COMMENT"'<>'':'%-
%-
%WRAPPED=_%SETPATTREGEXP="(?is-m)^(.*?)(\n(((\w{0,5}(\>\s*)+)?\s*\n))+(.*)\s*$|\z)"%-
%-%-%-%-%-%REGEXPBLINDMATCH="%COMMENT"%-
%-%-%-%-%-%SUBPATT="1"_%-
%-
%SETPATTREGEXP="(?is-m)^(.*?)((\n(((\w{0,5}(\>\s*)+)?\s*\n))+)(.*)\s*$|\z)"%-
%REGEXPBLINDMATCH="%COMMENT"%-
%SUBPATT="3"%-
%-
%COMMENT=_%SETPATTREGEXP="(?is-m)^(.*?)(\n(((\w{0,5}(\>\s*)+)?\s*\n))+(.*)\s*$|\z)"%-
%-%-%-%-%-%REGEXPBLINDMATCH="%COMMENT"%-
%-%-%-%-%-%SUBPATT="7"_%-
%QINCLUDE="wrap2"'
=====[ End modified wrap2]=====
This is still untested, but only the middle regexp was changed. I
merely added a pair of parentheses to capture the "blank" lines in
their own subpattern.
I'll break down one of these regexps since all three are the same,
except maybe for some subpattern capturing. This won't be my most
stellar explanation, but it might give you a reasonable start.
(?is-m) - Option setting
- Ignore case (not necessary), dot all, not multiline
^ - Match beginning (not of any line because of multiline
being unset above)
(.*?) - Match the minimum number of "any character" that allows
the rest of the expression to match and store it in
subpattern 1
Note the rest of the pattern is captured in subpattern 2, so I'll
break it down a bit differently. Since the critical part of this
regexp is simply detecting "blank" lines, let's focus on that
part. Note, this section is now captured in subpattern 3 so it
can be extracted.
((\n - Start subpatterns 2 & 3 and require a newline character
((( - Start subpatterns 4, 5 and 6 respectively (needed for
repeat operators)
\w{0,5} - Look for upto 5 alphanumeric characters starting the
line (for initials or name quoting).
(\>\s*)+ - Look for one or more quote characters ">". They can be
separated by as much or as little white space as
needed. The quote character & whitespace deal are in
subpattern 7 simply for the repeat operator.
)? - Close subpattern 6 and allow 0 or 1 instances of this
entire subpattern. This is because a "blank" line
could be truly blank, or it could have been quoted by
the mail client.
\s*\n) - Get as much whitespace as necessary and require a
newline. This ensures that we do have at least one
"blank" line between the first paragraph and the
second. Capture this "blank line" in subpattern 5.
)+) - Close subpattern 4 (which seems to be the same as
5...I don't remember why I did that...) and look for
one or more instances of these "blank" lines. All of
this is captured in 3. So all the "blank" lines are in
subpattern 3. Note the end of line for the end of the
first paragraph is also in this subpattern.
Now for the cleanup:
(.*)\s*$ - Capture the rest of the paragraphs in subpattern 8
|\z) - Or look for the end of the text instead of all the
newline junk. Necessary if you are processing the last
paragraph, which might not be terminated with a blank
line. Close subpattern 2.
--
Thanks for writing,
Januk Aggarwal
________________________________________________________
http://www.silverstones.com/thebat/TBUDLInfo.html