Override Compilation Replacements

Does anyone know how to override replacements in the text when compiling?
I have a character ‘Peter’ which I choose tor replace to Sean (long story) in compilation…
But want to make reference to St Peter in my text. Compile keeps changing it to ‘St Sean’.

Anyone know a way around this? (I can’t change the name of Saint Peter)

The text replacements in Compile are executed from top to down in the list.

So just replace “Peter” by “Sean” and afterwards “St Sean” by “St Peter”.

And if any petering (or similar) occurs in your text make sure to tick Case-Sensitive and Whole Word in the first replacement.

And by the way, since the change from Peter to Sean seems not to be related to a specific Compile format (like for example one editor you send the manuscript to wants or wants not straight quotes and they get replaced only in compiling for that very editor) you might also do the replacing right in the document by Project Replace. In two steps again. With RegEx you could do it in one but in this case two steps are simpler.

You could solve this problem by using the “RegEx” checkbox for your replacement, and providing the following pattern in the Replace column:

(?<!\bSt )Peter

What this means is: match any instance of the word “Peter”, but only if the characters leading up to it are not "St ", where the “S” represents a word boundary (\b). Word boundaries are spaces or punctuation marks. Thus this would trigger on "St Peter had it right when he said, 'Blah blah...'", but it would not trigger on First Peter had to open the box.... So everything you type in the (?<!) part, after the exclamation point, means to only match stuff following anything not what you type in. If you leave the exclamation point out, like (?<\bSt )Peter, then you would only find cases of “St Peter”, but only change the part outside of parentheses. Thus inserting With as “John” would result in “St John” when compiled.

Isn’t this contradictory, or am I confused?

You’re confused. It will do what the OP wants, change every instance of “Peter” to whatever they put in the ‘with’ field, except where “Peter” is preceded by "St ". In other words “St Peter” will be unchanged but his character’s name will be changed from “Peter” to “Sean” or whatever.

:slight_smile:

Mark

You’re saying it won’t trigger when it’s preceded by St, aren’t you?

(I didn’t say it wouldn’t do what the OP eants.)

Thank you all who contributed. I was able to solve the issue with the simple Compile Replacement from Peter → Sean and then St Sean to St Peter. It solved my reference to St Petersburg as well, but I had to reword the sentence containing “past peter’s head”, which wasn’t a terrible problem for me. Thanks again all.