• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

GREP style

Participant ,
Dec 01, 2016 Dec 01, 2016

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.

TOPICS
Scripting

Views

1.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Mentor , Dec 01, 2016 Dec 01, 2016

In GREP tab:

find (<i>)([^<]+)(<i>)

change to $2

in Change Format field define your italic style.

Votes

Translate

Translate
Mentor ,
Dec 01, 2016 Dec 01, 2016

Copy link to clipboard

Copied

In GREP tab:

find (<i>)([^<]+)(<i>)

change to $2

in Change Format field define your italic style.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 01, 2016 Dec 01, 2016

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Dec 01, 2016 Dec 01, 2016

Copy link to clipboard

Copied

LATEST

"GREP is greedy". <i>(.+)<i> won't work if you have more than one occurence of <i>some text<i> in a paragraph...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 01, 2016 Dec 01, 2016

Copy link to clipboard

Copied

Brilliant, thanks! worked exactly as I needed!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Dec 01, 2016 Dec 01, 2016

Copy link to clipboard

Copied

You're welcome.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines