On Sun 1-Jun-03 5:11am-0400, Carsten Th�nges wrote:

> * Bill McCarthy <[EMAIL PROTECTED]> writes:

>> The key is knowing what macro represents the clip board.  I couldn't
>> find it.

> %CLIPBOARD

Thanks for responding.  That was sure simple.  But now that I have you
on the line <g> ...

Although I'm still a rookie WRT TB and PCRE, I'm fairly familiar with
regex ala Vim and SED.

I was playing around today with the Add Reference macro.  The task of
adding the reference looks easy.  But removing the references has been
surprisingly difficult.

Let's start off with a simplifying assumption.  Let's assume that
either there is no In-Reply-To or Reference lines OR they are both
present with the Reference lines immediately following the In-Reply-To
line.

To just remove them, I thought this would work:

%SetPattRegExp="(?is)((.*\n)%-
In-Reply-To:.*?\nReferences:.*?\n%-
(?:\s.*?\n)*)%-
|((.*\n))%-
(.*)\n"%-
%RegExpBlindMatch="%Headers"%SubPatt="2"%SubPatt="4"%SubPatt="5"
%Text

If they exist, SubPatt 2 contains the header text before the
In-Reply-To line as expected.  However SubPatt 5 is empty.

I pasted the header to Vim editor session and typed the command:

s/\v((\_.*\n)In-Reply-To:.*\nReferences:.*\n%(\s.*\n)*)|((\_.*\n))(\_.*)/\2\4\5

This worked perfectly.

Let's compare the regex portion of the two.  First a brief explanation
of the differences between PCRE and Vim's regex.  The `\v` means "Very
magic" and permits writing, for example, parens without escaping them.
Vim's `.` does not match `\n`.  PCRE's `.*` is like Vim's `\_.*`.
PCRE's `(?:` is like Vim's '%(`.

Now here they are next to each other with PCRE first:

((.*\n)In-Reply-To:.*?\nReferences:.*?\n(?:\s.*?\n)*)|((.*\n))(.*)
((\_.*\n)In-Reply-To:.*\nReferences:.*\n%(\s.*\n)*)|((\_.*\n))(\_.*)

I believe these should behave identically but they don't.  TB is
excluding all header lines after the Reference lines.  The Vim search
/ replace, works as intended.

Any idea with the PCRE macro is failing?

-- 
Best regards,
Bill

"Commonly, those who have professed the strongest motives of love of a
 God have demonstrated the deepest hatred toward human joy and liberty."
           [E. Haldeman-Julius, "The Meaning Of Atheism"]


________________________________________________________

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

Reply via email to