Find/Change single "end of paragraph" breaks but not double?
Learn / Forums / General InDesign Topics / Find/Change single "end of paragraph" breaks but not double?
Tagged: change, End of paragraph, find, GREP
- This topic has 4 replies, 3 voices, and was last updated 7 years, 1 month ago by Jeremy Bassetti.
-
AuthorPosts
-
-
February 17, 2017 at 2:57 pm #92279Jeremy BassettiMember
Hi, everyone.
New to the forums and InDesign and seeking wise council. :) I searched for the the answer to my question, but had no luck.
I have a text in InDesign that has a lot of “end of paragraph” breaks randomly throughout the paragraphs. My paragraphs are broken up. I want to delete those and replace them with spaces. However, at the end of the paragraphs, there are two “end of paragraph” breaks. Every time I do a grep find/change \r to space, it picks up the double “end of paragraph breaks” and messes up the formatting more. ARrrgh. Any ideas?
To illustrate what I mean, included is an example of my problem… where the “(\r)” refers to the “end of paragraph” breaks:
Pangloss enseignait la métaphysico-théologo-cosmolonigologie. Il(\r)
prouvait admirablement qu’il n’y a point d’effet sans cause, et(\r)
que, dans ce meilleur des mondes possibles, le château de(\r)
monseigneur le baron était le plus beau des châteaux, et madame(\r)
la meilleure des baronnes possibles.(\r)
(\r)
Pangloss enseignait la métaphysico-théologo-cosmolonigologie. Il(\r)
prouvait admirablement qu’il n’y a point d’effet sans cause, et(\r)
que, dans ce meilleur des mondes possibles, le château de(\r)
monseigneur le baron était le plus beau des châteaux, et madame(\r)
la meilleure des baronnes possibles.(\r)
(\r)The two paragraphs above are the same, but this is for illustrative purposes only to show that the problem continues similarly. I would like to replace the single (\r)s at the end of the lines with spaces, but ignore the (\r)s between the natural paragraphs. Any idea?
Thank you!
-
February 17, 2017 at 3:28 pm #92281Jeremy BassettiMember
Find \b\r and replace to \r will take care of all of the artificial breaks within the paragraph, but not the natural paragraphs. That code, however, will not take care of artificial breaks following punctuation like commas, semicolons, etc. Any help?
-
February 17, 2017 at 7:10 pm #92282David BlatnerKeymaster
You probably want to do something similar to this:
https://creativepro.com/merging-paragraphs-with-findchange.php -
February 18, 2017 at 8:14 am #92283Kai RübsamenMember
Hi Jeremy,
if you want to have real control, I would try it this way:
1.
Find what: (?<!~b)~b(?!~b)
Change to: \x202.
Find what: \x20{2,}
Change to: nothing3.
Find what: ^~b
Change to: nothingSome explanation: It’s always good practice to have an overview. So there are several steps needed. First remove those unwanted returns (1). Since \r will also find pagebreaks, use ~b instead. So the first one will find a return, that is not preceeded or followed by a return. Since you cannot guarantee, that there is a space already or not, insert a space and remove double space if needed (2). I assume, that you apply a para style with space after. So remove the empty return (3)
Kai
-
February 18, 2017 at 5:17 pm #92288Jeremy BassettiMember
Very helpful, friends. Thank you.
-
-
AuthorPosts
- You must be logged in to reply to this topic.