BUG - 2020 - Scripting - GREP - Can't replace by empty string
In Indesign 2020, changing a GREP search result to an empty string doesn't work.
app.changeGrepPreferences.changeTo = "";
In a Text search it does work perfectly...
app.changeTextPreferences.changeTo = "";
-
m1b commented
I found the same issue just now. The problem occurs in the normal Find Text and Find Grep UI also.
I think it is because the UI has no way to distinguish between changeTo === "" and changeTo === undefined.
So my guess is Adobe decided to just disable changeTo in cases where you are changing other properties, eg. Paragraph Style. It's a shame that it is also disabled in the scripting API, where we can explicitly set changeTo to undefined if we want it ignored.
I would like this fixed too. The UI should have an "Ignore" option for changeTo similar to the way styles' properties can sometimes be set to "ignore".
Both the attached screenshots, showing a search for a number with a tab should remove the number and apply the new paragraph style, but both fail because the changeTo is ignored.
-
[Deleted User] commented
This should be a priority, in my opinion. Replacing text with empty string is very common usage.