Hi all,
I’ve encountered a strange situation whereby a repurposed FindChangeByList.jsx gives me incorrect results… sometimes! The fix is even stranger to me, but it may also be the clue needed for fixing my GREP.
I work with a catalogue with prices scattered throughout, and I use a FindChangeByList.jsx script to find a style by code and replace it with it’s respective price. Here’s a rough idea of the starting point with 1234 used to indicate out of date price values for VR17, UE92 and UM81 with vary amounts of text between the codes and their prices:

Of course, the business end of this script is in the support.txt file. The first line of my .txt file picks out any price and turns it into XX:
grep {findWhat:"d+,~=s€"} {changeTo:"XX,~=~s€"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
Then I use the following (output from an Excel sheet) to drop in the correct prices
grep {findWhat:"(?s)(VR17.+?)XX,~=s€"} {changeTo:"$1349,~=~s€"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
grep {findWhat:"(?s)(UE92.+?)XX,~=s€"} {changeTo:"$1169,~=~s€"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
grep {findWhat:"(?s)(UM81.+?)XX,~=s€"} {changeTo:"$1129,~=~s€"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
If I run the script with nothing selected it works as expected. If choose to run it on the ‘Selected Story’ or ‘Document’ it also works.
But… when I run the script having highlighted all of the text in the frame first, i.e. ‘Selection’, the last price isn’t replaced. In fact, it unhighlights the last character.

If I manually add a single space after the euro symbol then all is good again.
Is there a flaw in my GREP strings?