You can remove the merge field markers by doing a PLAIN TEXT find/change for <feff> and replace with nothing. That should allow your script to work.
Outstanding! I should have checked here first. This simple solution will save hours and hours of manual, tedious work.
Thank you! !
Just to give credit where it's really due, I learned the <feff> trick from Uwe Laubender in another topic a couple of years ago. It's priceless.
Thank you for your kind words, Peter.
Back to the special character <FEFF>.
Be aware, that this character can stand for several things:
1. XML tag markers
2. Index markers
3. Notes markers
4. Conditional Text markers
5. Hyperlink markers *
* I just crashed my InDesign CS6 v8.1.0 as I tried to replace <FEFF> (a "closing" hyperlink marker) with "nothing" by using Text Search/Replace. I did not chose "Replace All", but did it step-by-step. "Replace All" did work on the same sample.
Here a screenshot before and after removing <FEFF> with InDesign CS6 v8.1.0 on Mac OSX 10.6.8:
As you can see replacing with nothing ( = delete) worked in the data merge case.
But also with index markers, hyperlink anchor markers. XML tag markers and conditional text markers were not removed.
A bit strange is the case where the "normal" character "N" of the word "Notes" was removed.
"N" is following an InDesign note object.
I did not test with all the CC versions…
On with the case for notes in text and "removing" of <FEFF> characters.
A note at the beginning and the end of a story will not see the effect.
White space before a note at the beginning of a story will not force the effect.
Normal text does.
Here another screenshot where some notes are present.
Text search/replace will remove text other than the <FEFF> characters every time you run the test. And it will remove more regular text the more you run search/replace on the same text with the notes.
Could be a bug.
Together with an IDML file you can download from my Dropbox account:
Now I had the chance to test with InDesign CC v9.3.0 and I can see no difference with the tests for CS6 v8.1.0.
(Mac OSX 10.6.8)
Can someone confirm the same results on a Windows version of InDesign?