Copy link to clipboard
Copied
Hello!
In my text the letter g means glossary.
And I need DELETE all paragraph contains only numbers. I mean, I need keep the paragraph if contain the cross references like the letter g and (See...)
Here you can see in color PINK the paragraph I need delete.

here is my code, but I don't know how can I EXCLUDE the other paragraph.
replaceTextUsingGREP ("+(\\d[–\\d, -]*\\d?) *","\r");
function replaceTextUsingGREP (input, output) {
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.findWhat = input;
app.changeGrepPreferences.changeTo = output;
var changedResults = app.activeDocument.changeGrep();
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
}
Thanks so much!
Hi Manuel,
I would suggest you use a negative lookahead to filter those "g" and "(See…" patterns.
For example:
replaceTextUsingGREP("^(?!.+ (g|\\(See [^)]+\\)),? \\d).+ \\d[\\d, -]*\\r", "");
// ...
The pattern /^(?!.+ (g|\(See [^)]+\)),? \d).+ \d[\d, -]*\r/ can be thought as follows:

@+
Marc
Copy link to clipboard
Copied
Hi Manuel,
I would suggest you use a negative lookahead to filter those "g" and "(See…" patterns.
For example:
replaceTextUsingGREP("^(?!.+ (g|\\(See [^)]+\\)),? \\d).+ \\d[\\d, -]*\\r", "");
// ...
The pattern /^(?!.+ (g|\(See [^)]+\)),? \d).+ \d[\d, -]*\r/ can be thought as follows:

@+
Marc
Copy link to clipboard
Copied
Hi Marc,
very kindness, for the explanation.
Thanks so much are working fantastic!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now