This content has been marked as final. Show 4 replies
There's nothing wrong with your regular expression, it works fine, though you make things unnecessarily complicated. You might as well use this one:
>var myfound = txt.match( /( [\d.,]+)/g );
which does the same. But the reason why it doesn't work is that with your regular expression you collect an array (myfound), and then apply something to that array -- apply noBreak. This has no effect on the array at all (because noBreak is relevant to InDesign objects, not to arrays of strings), and your InDesign document is unaffected.
Before we go on it is useful to know which version of InDesign you use (CS 2, 3, or 4).
Fantastic and clear (considering that I am a newbie).
I didn't expect an answer from you and I'm glad.
Excuse my ot and let's answer.
I'm using InDesign CS 3
Thanks for your kind words. As to your script, you were caught up in big changes between CS2 and CS3/4. Your approach (approaching InDesign stories as text) was going the CS2 way, which was the only way to go because CS2 did not know GREP natively. But CS3 and CS4 do know GREP natively, which make many things a lot easier. What you want to do ca\n be scripted in CS3 as follows:1 person found this helpful
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.findWhat = " [\\d.,]+";
app.changeGrepPreferences.noBreak = true;
The O'Reilly titles aren't clear on this -- yet. They soon will be.
Thank you so much.
Works perfect (don't need to tell you)