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

GREP Operation to Remove Return within Item Paragraph while Maintaining Return Between Items

Community Beginner ,
Jul 05, 2023 Jul 05, 2023

Copy link to clipboard

Copied

Hello,

 

I have a document that is structured in the following way:

 

A0. Item A0 text.... ending with a period.

A1. Item A1 text.... ending with a period.

B1. etc.

...

 

In parts of this document, the item's paragraph has a return within it such that the following occurs:

 

C933. Item C933 text... \r

text continues as new paragraph (break may occur between words, numbers, following puncuation, etc.).

C934. Item C934 text...   .

C935. etc.

 

I am trying to figure out a GREP script that will remove any return within an item's paragraph. The GREP script would ensure that if a period followed by a return, followed by any sequence of 1 letter and 1 or more numbers followed by a period as seen here:

C934. Item C934 text...   .\r

C935. etc.

 

would be maintained; however, if the following occurs

 

C933. Item C933 text... \r

continues as new paragraph.

C934. Item C934 text...   .

 

the script would remove the return such that the above would appear as follows:

 

C933. Item C933 text continues in same paragraph.

C934. Item C934 text...   .

 

Thank you very much for any help you may be able to provide.

 

TOPICS
How to , Scripting

Views

146

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

Guide , Jul 05, 2023 Jul 05, 2023

Find: (^\D\d+\.\h).+\K\r(?!(?1))

Replace by a simple common space

 

(^/)  The Jedi

Votes

Translate

Translate
Guide ,
Jul 05, 2023 Jul 05, 2023

Copy link to clipboard

Copied

Find: (^\D\d+\.\h).+\K\r(?!(?1))

Replace by a simple common space

 

(^/)  The Jedi

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
Community Beginner ,
Jul 05, 2023 Jul 05, 2023

Copy link to clipboard

Copied

LATEST

Thank you FRIdNGE for your help - this was the answer!

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