do you really work wtih manually created numbered lists? That's not the best way.
All the same – one variant:
replace this line:
app.findGrepPreferences.findWhat = "(?<=^\d)\. |(?<=^\d\d)\. ";
app.findGrepPreferences.findWhat = /(?<=^\d)\. |(?<=^\d\d)\. /.source;
- - - - - - -
But IMHO better is:
app.findGrepPreferences.findWhat = /^(\d+)\./.source; app.changeGrepPreferences.changeTo = "$1)";
And the best way:
automatically numbered lists – several settings possible and no Grep needed
Its just for a quiz in a newspaper. The list comes in text, and I want it formatted slightly different. Now I can just run the script, and everything is OK. again, thank you!
Hi David and Pixxxel,
A very clever script written by Kaï Rubsamen!
At the beginning, text with "1. ", "2. ", … (manual numbering):
Simply create the 3 para styles you need (with auto-numbering as Pixxxel suggested! ):
Launch Kaï's script:
Its UI appears. Only type the Grep code you need to make the research, choose your 3 para styles, as indicated in the screenshot, and finish by "OK":
I like a lot this script! Thanks Kaï to have written it!