Skip to main content
sandern35778536
Participant
July 4, 2019
Question

occurring errors FindChangeByList

  • July 4, 2019
  • 1 reply
  • 418 views

Hi all,

I'm in the making of a find and replace script for a catalog we're producing. I'm doing this the standard way, by using the FindChangeByList.jsx which comes with the package and creating a custom findChangeList.txt file. However when i start to add lookbehinds / negative lookbehinds the JSX keeps on throwing errors at me.

Here's an example which does not work;

text {findWhat:" ,"} {changeTo:","} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Delete space before comma

grep {findWhat:"<=[ ](?!\D)"} {changeTo:"<="} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Delete space before comma

grep {findWhat:"(?<=\b[o|O])2"} {appliedCharacterStyle:"subscript"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:true} Apply subscript to O2

For some reason it is able to execute the first 2 but the 3rd command throws me errors. I've seen the 30477 come by as well as the 25. I've looked at numerous resources but i'm unable to find a good solution which gives me the real answers. These findWhat commands work perfectly in the GREP window of indesign but are unable to work the the find and change list...

Another part is that i'm unable to work with copy patterns ie.

I want to make sure there's a space between the unit of measurement and the unit number by having this (non working) GREP style;

([0-9]{1.}|{1,})([mm|cm|m|µ|µm|dm|])

And this replacement;

$1 $2

And third;

Non-breaking spaces (which i would like to include in the GREP shown above with the units of measurement are not working either, they work again in the Indesign GREP window, but not with the lists (coping the ~S will give me a unicode character in Sublime, and surprisingly neither of the options work with the change list)

Hopefully one or some of you have answers to my questions.

Thanks in advance!

Sander

This topic has been closed for replies.

1 reply

Stefan Rakete
Inspiring
July 5, 2019

Regarding your first issue:

This line works fine for me, if I am escaping the "\b" with an extra "\"

grep {findWhat:"(?<=\\b[o|O])2"} {appliedCharacterStyle:"subscript"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:true} Apply subscript to O2

Does the characterStyle exist in the document ?

Thanks Stefan

sandern35778536
Participant
July 5, 2019

Thanks, this was indeed the problem. In the characterStyle panel it had a space behind the name (didn't notice by typing over the name). So by copying it directly over I noticed this problem. Thanks a lot for the answer!

The Third question i have I have also resolved by making a character style which has the noBreak functionality.

But the second question still remains.

I would like to have the measurement and the unit combined (always with a nonBreaking space) So the function should look out for any of the

1mm or 1 mm or 1.0 mm or 1.09mm

And it should be replaced with always [UNIT] nonbreaking space [MEASUREMENT]

Does anyone have a GREP style for this?