Skip to main content
manuelb27477138
Inspiring
August 20, 2018
Answered

GREP at the begining with any Letter

  • August 20, 2018
  • 1 reply
  • 446 views

Hello,

I try to remove the comma in an Index Reference,  always at the beginning of the paragraph, followed by the letter g

INCORRECT:

Human, g

human, g

CORRECT:

Human g

human g

But is not working:

replaceTextUsingGREP ("((\^\[\\l\\u\]\*\?)$)(, g)","$1 g");

function replaceTextUsingGREP (input, output) {

    app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;

    app.findGrepPreferences.findWhat = input;

    app.changeGrepPreferences.changeTo = output;

    //app.activeDocument.changeGrep();

    var changedResults = app.activeDocument.changeGrep();

    app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;

}

Please, do you know what is wrong?

Thanks so much.

This topic has been closed for replies.
Correct answer Peter Kahrel

Find: "^.+?\\K,(?= g)"

Replace: ""

P.

1 reply

Peter Kahrel
Community Expert
Peter KahrelCommunity ExpertCorrect answer
Community Expert
August 20, 2018

Find: "^.+?\\K,(?= g)"

Replace: ""

P.

manuelb27477138
Inspiring
August 20, 2018

thanks Peter!

I learn a lot with you.