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

Using GREP to find the end of a paragraph and ignoring forced break lines

Explorer ,
Jan 06, 2021 Jan 06, 2021

Copy link to clipboard

Copied

Hi everyone and happy new year,

 

I'm stuck with a grep problem I thought would be easy, but its not, at least for me.

I need to do a grep search to every coma "," at the end of a paragraph and replace it with nothing. At first I was using "$" at the end of the paragraph because it's supposed to mean "end of paragraph", but unfortunately, it's also searching the "," at the end of a forced break line inside a paragraph.

 

The the GREP is basicaly:

,$

 

 

 

I tried this one too:

,(?:[\n])$

(?:[\n]) is supposed to ignore \n which is a forced break line I thought.

 

 

So, have you any idea on how I can ignore the forced break lines in a paragraph?

 

Thanks everyone,

Nicolas

TOPICS
How to , Scripting

Views

1.1K

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

Community Expert , Jan 06, 2021 Jan 06, 2021

Use this:

,(?=~b)

Votes

Translate

Translate
Community Expert ,
Jan 06, 2021 Jan 06, 2021

Copy link to clipboard

Copied

Use this:

,(?=~b)

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 Expert ,
Jan 06, 2021 Jan 06, 2021

Copy link to clipboard

Copied

or this:

,(?!\n)$

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
Explorer ,
Jan 06, 2021 Jan 06, 2021

Copy link to clipboard

Copied

LATEST

Thanks a lot Jean-Claude, both solutions work perfectly!

 

If I understand, the first one search for a "coma" and after it the search must be followed by a paragraph mark, and the second one should be the correct syntax to find any coma at the end of a paragraph excluding any forced break line.

 

Thanks again! 🙂

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