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"
see how the enrty for culture has changed
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)]
Alternatively, just use a regular expression (GREP) that specifies only a comma that appears at the end of a paragraph:
,$
~Barb
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)]
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
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
Copy link to clipboard
Copied
that is great, I didn't realize I could leave the replace field blank. why the dollar sign??
Copy link to clipboard
Copied
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.