Copy link to clipboard
Copied
Hi, can anyone help with the following please, I've tried quite a few solutions to this that i've found online but can't get any of them to work.
I basically need to apply some standard italic styling to some text. it comes to me as below.
"some text and some more text <i>Im a name so i need italicising<i> and then <i>so am I<i>, is this possible?
I want to italicise the text that is within the "<i>" and "<i>" and then remove all instances of the "<i>" in one script. Stuck and frustrated.
Its probably very basic, so sorry for the inane question.
In GREP tab:
find (<i>)([^<]+)(<i>)
change to $2
in Change Format field define your italic style.
Copy link to clipboard
Copied
In GREP tab:
find (<i>)([^<]+)(<i>)
change to $2
in Change Format field define your italic style.
Copy link to clipboard
Copied
Hi,
Make ensure the "italic" character style need to be available in the document.
Try the below code,
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.findWhat = "<i>(.+)<i>"
app.changeGrepPreferences.changeTo = "$1";
app.changeGrepPreferences.appliedCharacterStyle = "italic";
app.activeDocument.changeGrep();
Regards
Siraj
Copy link to clipboard
Copied
"GREP is greedy". <i>(.+)<i> won't work if you have more than one occurence of <i>some text<i> in a paragraph...
Copy link to clipboard
Copied
Brilliant, thanks! worked exactly as I needed!
Copy link to clipboard
Copied
You're welcome.