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

Grep: Delete the whole line of any words.

Explorer ,
Aug 23, 2018 Aug 23, 2018

Hi guys,

Is it possible in Grep to delete the last line?

Thanks

2.0K
Translate
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

Community Expert , Aug 28, 2018 Aug 28, 2018

Hi,

you cannot remove something using a GREP Style.

If you like you can make it invisible using e.g. a character style that applies No Fill and No Stroke, but you cannot remove it.

Regards,
Uwe

Translate
Explorer ,
Aug 23, 2018 Aug 23, 2018

Sorry - should be last line with keyword "Phone"

Translate
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
Community Expert ,
Aug 24, 2018 Aug 24, 2018

Hi,

if you find a pattern that describes all lines you want to remove starting with "Phone:" you can do this with GREP Find/Replace.

And if all the lines share the same paragraph style, the better you will be able to find the right lines.

A possible GREP pattern could be:

\s?Phone:\s\d{2}\s\d{4}\s\d{4}

Since you were showing an example without turning on Hidden Characters I cannot tell if this will work since I do not know if white space of any kind is following after the last sequence of numbers.

Regards,
Uwe

Translate
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
Explorer ,
Aug 27, 2018 Aug 27, 2018

Hi Uwe,

How this could work with paragraph grep style?

Translate
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
Community Expert ,
Aug 28, 2018 Aug 28, 2018

Hi,

you cannot remove something using a GREP Style.

If you like you can make it invisible using e.g. a character style that applies No Fill and No Stroke, but you cannot remove it.

Regards,
Uwe

Translate
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 ,
Aug 28, 2018 Aug 28, 2018
LATEST

sarahkay  wrote

How this could work with paragraph grep style?

As Uwe said already, it won't. The keyword here is style. You can't edit content just applying text style. Nevertheless you still have more than one option:

1. Using Find/Change just find and remove unwanted text. Since your phone numbers don't follow a strict pattern I would use something like Phone:[\x{20}\d]+

Simple and reliable, but can not be undone later.

2. Using the same regex find your text and apply special char or para style to it, using color [None] or [Paper]. It will effectively hide unwanted text.

This approach could be used as a 'paragraph grep style'. Not really recommended since *hidden* text portions are still here, and they will re-appear if you copy / paste your text, say, to another application.

3. Use conditional text feature: create new condition for your Phone lines, using Find/Change and regex from above apply that condition to text that should be 'removed'. Now you have full control: you can turn Phones condition visibility on/off, copy/paste correct text to another apps, etc.

Translate
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