Strange bug in the Replace filter
Posted: Thu Dec 13, 2018 5:50 am
My input USFM file has 66 books, with each book starting like this:
NB. The file has Unix style EOLs.
My filter to add a Running Header and Table of Contents markers is as follows:
The output file becomes:
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.
The output is then:
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
Code: Select all
\id GEN
\mt Genesisy
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
Code: Select all
\id GEN
\h Genesisy
\toc1 Genesisy
\toc Genesisy
\toc3 Genesisy
\mt Genesisy
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
Code: Select all
\id GEN
\h Genesisy
\toc1 Genesisy
\toc2 Genesisy
\toc3 Genesisy
\mt Genesisy
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