Thanks, Carsten, for looking this over.  I appreciate your efforts.

On Tue 3-Jun-03 6:21pm-0400, Carsten Th�nges wrote:

> 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.
>
>     ){0,2}  #  <- !!!

I had tried that on an earlier pass, but gave up on it.  To save time
testing, I set up a little predictive test in Vim.  Of the 21
possibilities, 13 worked and 8 failed.  Looking closer at the
failures, they represent all the possibilities within header info
between the IRT and References.  In each case the info between was
lost in the result.

I then preceded to test the actual short PCRE macro and found the
predictive model was accurate.  All 8 cases failed.  When the IRT and
References were at each end of the header, the failure was spectacular
:-)

So what's happening?  Suppose we have:

   Blk1 IRT Blk2 Ref Blk3

Block 1 goes to \1, Blk2 goes to \2, then Blk3 replaces \2 - the
middle gets lost.  The other seven cases can be explained the same
way - in have the 8 failed cases the middle is replaced with an empty
Blk3.

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

Although it works in all cases where the IRT and References are
adjacent, even if the official rules call for them to be that way, I
prefer not to count on it.

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

I tried replacing \n\n with \n+.  In only worked sometimes.  If the
last line contained: Last Line Info

I either got:

    Last Line InfoIn-Reply-To: <....>

    Body

Or the correct:

    Last Line Info
    In-Reply-To: <....>

    Body

I found playing around with the spaces between the header and text to
be the most frustrating.  I used combinations of \n and \z or \Z and
even $ with I was using {?-m).  I'm still at the guess and try stage
with this particular aspect of PCRE.

-- 
Best regards,
Bill

"It was once proposed that all religions persuasions should be free and
 their worship publicly exercised.  We Catholics have rejected this article
 as contrary to Roman Catholic canon law."
                     [Pope Pius VII, 1808]


________________________________________________________

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

Reply via email to