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

search and replace paragraph return affects following paragraph

Contributor ,
Jul 11, 2020 Jul 11, 2020

Copy link to clipboard

Copied

I'm using  global search and replace to clean up  huge lsits of data. I have added specail cahracters to defien headings and  subheadings but sometiems teh data field is  empty - so I am left with  a comma followed by a  hard return [paragraph]

I'd like to search a nd replace  the following , ^p with just ^p. But when I do that it affects teh following paragraph and cahnges its style to the style of the one I'm workign on. How to get around that? this behavior is both for GREP and  text find/change. See the comma after  "Laboratoire"

notannhavoc_0-1594513126597.png

see how the enrty for culture has changed

notannhavoc_1-1594513298066.png

 

 

TOPICS
How to

Views

281

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 2 Correct answers

Community Expert , Jul 13, 2020 Jul 13, 2020

Remove a paragraph return -> the following characters will now be a part of the first paragraph (with the same format as the previous first paragraph!). Insert a new paragraph sign -> the format remains.

Why you do not use a positive lookahead instead?

Find what:

(,\h)(?=\r)

Change to:

[nothing (leave this field blank)]

Votes

Translate

Translate
Community Expert , Jul 13, 2020 Jul 13, 2020

Alternatively, just use a regular expression (GREP) that specifies only a comma that appears at the end of a paragraph:
,$

 

~Barb

 

grep.gif

Votes

Translate

Translate
Community Expert ,
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

Remove a paragraph return -> the following characters will now be a part of the first paragraph (with the same format as the previous first paragraph!). Insert a new paragraph sign -> the format remains.

Why you do not use a positive lookahead instead?

Find what:

(,\h)(?=\r)

Change to:

[nothing (leave this field blank)]

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
Contributor ,
Jul 19, 2020 Jul 19, 2020

Copy link to clipboard

Copied

that works - thank you and it enabled me to expand the search to  address other characters - just wish I knew what it meant

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 ,
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

Alternatively, just use a regular expression (GREP) that specifies only a comma that appears at the end of a paragraph:
,$

 

~Barb

 

grep.gif

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
Contributor ,
Jul 19, 2020 Jul 19, 2020

Copy link to clipboard

Copied

that is great, I didn't realize I could leave the replace field blank. why the dollar sign??

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
Enthusiast ,
Jul 19, 2020 Jul 19, 2020

Copy link to clipboard

Copied

LATEST

The dollar sign is a location metacharacter for End of Paragraph, which is a fancy way of saying find all text in the Find field that is located at the end of a paragraph, but do not include any other characters beyond that, such as the paragraph return.

So the comma must appear as the last character in the paragraph, and only the comma will be replaced, not the paragraph return. Your original Find/Replace strings included the paragraph return character, which is why it was changing the paragraph style as well.

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