Strange bug in the Replace filter

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
dfhtextpipe
Posts: 986
Joined: Sun Dec 09, 2007 2:49 am
Location: UK

Strange bug in the Replace filter

Post by dfhtextpipe »

My input USFM file has 66 books, with each book starting like this:

Code: Select all

\id GEN
\mt Genesisy
NB. The file has Unix style EOLs.

My filter to add a Running Header and Table of Contents markers is as follows:

Code: Select all

Perl pattern [^(\\mt )(.+)$] with [\\h $2\n\\toc1 $2\n\\toc2 $2\n\\toc3 $2\n$1$$2]
   [X] Match case
   [ ] Whole words only
   [ ] Case sensitive replace
   [ ] Prompt on replace
   [ ] Skip prompt if identical
   [ ] First only
   [ ] Extract matches
       Maximum text buffer size 4096
   [X] Maximum match (greedy)
   [ ] Allow comments
   [ ] '.' matches newline
   [X] UTF-8 Support
 
The output file becomes:

Code: Select all

\id GEN
\h Genesisy
\toc1 Genesisy
\toc Genesisy
\toc3 Genesisy
\mt Genesisy
Observe that the number 2 is missing from where it should be in \toc2

If I edit the filter to include an extra 2 - then the output becomes correct.

Code: Select all

Perl pattern [^(\\mt )(.+)$] with [\\h $2\n\\toc1 $2\n\\toc22 $2\n\\toc3 $2\n$1$$2]
   [X] Match case
   [ ] Whole words only
   [ ] Case sensitive replace
   [ ] Prompt on replace
   [ ] Skip prompt if identical
   [ ] First only
   [ ] Extract matches
       Maximum text buffer size 4096
   [X] Maximum match (greedy)
   [ ] Allow comments
   [ ] '.' matches newline
   [X] UTF-8 Support
 
The output is then:

Code: Select all

\id GEN
\h Genesisy
\toc1 Genesisy
\toc2 Genesisy
\toc3 Genesisy
\mt Genesisy
I can think of no logical explanation why the extra character 2 has to be used to prevent the omission.

Is there a subtle software bug in TextPipe 10.7.2 ?

Further evidence: If I replace the single 2 by any other character, the filter works as I should expect.

Best regards,

David
David
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Strange bug in the Replace filter

Post by DataMystic Support »

Hi David - I have tried this here with no issues (10.7.2). Can you please email me the filter and test file?
dfhtextpipe
Posts: 986
Joined: Sun Dec 09, 2007 2:49 am
Location: UK

Re: Strange bug in the Replace filter

Post by dfhtextpipe »

Hi Simon,

It will take me a while to prepare an email with the attachments.

cf. I'll need to extract the dodgy sub-filter from a much more complex filter that I'm developing.

David
David
dfhtextpipe
Posts: 986
Joined: Sun Dec 09, 2007 2:49 am
Location: UK

Re: Strange bug in the Replace filter

Post by dfhtextpipe »

This bug seems to no longer occur in TextPipe 11.4

NB. I only tried it using the Trial Run area.

David
David
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Strange bug in the Replace filter

Post by DataMystic Support »

Thanks David!
Post Reply