REGEX: a single line should contain each word in a paragraph.
-
as seen below, each line in all the paraphrases is unfinished. The words at the beginning of each line in the paragraph are not a continuation of the previous line. I’m interested in connecting all the lines in the paraphrase without having any word breaks.
When the water rises up to F, the piece at A will be visible; when it reaches G, both A and B will be visible; and when it comes up to H, all three pieces will be visible. _Artificial Earthquake and Volcano._ Grind an equal quantity of fresh iron filings with pure sulphur, till the whole be reduced to a fine powder. Be careful not to let any wet come near it. Then bury about thirty pounds of it a foot deep in the earth, and in about six or eight hours the ground will heave and swell, and shortly after send forth smoke and flames like a burning mountain. If the earth is raised in a conical shape, it will be no bad miniature resemblance of one of the burning mountains. _Artificial Illuminations._ A very pleasing exhibition may be made with very little trouble or expense, in the following manner: Provide a box, which you fit up with architectural designs cut out on pasteboard; prick small holes in those parts of the building where you wish the illuminations to appear, observing, that in proportion to the perspective, the holes are to be made smaller; and on the near objects the holes are to be made larger. Behind these designs thus perforated, you fix a lamp or candle, but in such a manner that the reflection of the light shall only shine through the holes; then placing a light of just sufficient brilliance to show the design of the buildings before it, and making a hole for the sight at the front end of the box, you will have a very tolerable representation of illuminated buildings.THE OUTPUT
When the water rises up to F, the piece at A will be visible; when it reaches G, both A and B will be visible; and when it comes up to H, all three pieces will be visible. _Artificial Earthquake and Volcano._ Grind an equal quantity of fresh iron filings with pure sulphur, till the whole be reduced to a fine powder. Be careful not to let any wet come near it. Then bury about thirty pounds of it a foot deep in the earth, and in about six or eight hours the ground will heave and swell, and shortly after send forth smoke and flames like a burning mountain. If the earth is raised in a conical shape, it will be no bad miniature resemblance of one of the burning mountains. _Artificial Illuminations._ A very pleasing exhibition may be made with very little trouble or expense, in the following manner: Provide a box, which you fit up with architectural designs cut out on pasteboard; prick small holes in those parts of the building where you wish the illuminations to appear, observing, that in proportion to the perspective, the holes are to be made smaller; and on the near objects the holes are to be made larger. Behind these designs thus perforated, you fix a lamp or candle, but in such a manner that the reflection of the light shall only shine through the holes; then placing a light of just sufficient brilliance to show the design of the buildings before it, and making a hole for the sight at the front end of the box, you will have a very tolerable representation of illuminated buildings.My regex doesn’t work very good:
FIND:
^(.*?)$(\K.*)\rREPLACE BY:
\2OR (a better one)
FIND:
^(.*?)$(\R)REPLACE BY:
\1 -
Can you show the end line char that separates a line with the next one? Usually You could have one of the following:
\r\n
\r
\nFor example you could do something like:
find:
\r\n\r\n
replace:§§then:
find:\r\n
replace: "" [just a space without quotes]then back:
find:§§
replace:\r\n\r\n -
Find:
([^\r\n])\R([^\r\n])
Replace:\1 \2 -
@Coises very good answer, thanks a lot !
Find what:
\R+_.+_\R+(*SKIP)(*FAIL)|\RReplace with:
LEAVE A BLANK SPACE -
Hello, @Vasile-caraus, @wonkawilly, @coises and All,
@vasile-caraus, an alternate and more simple solution could be :
-
SEARCH
(?-s)(?<=.)\R(?=.) -
REPLACE
\x20
Best Regards,
guy038
-
-
Search:
(?<=[^\r\n])\r?\n(?=[^\r\n])Replace by:
leave an empy space -
@Vasile-Caraus Maybe I’m missing the point, but it seems to me that an easy solution is by standard N++. One can select whatever piece of text one wants and then hit
ctrl+j. This will join all lines in the selected text, creating a single (long) line. -
@Paul-Wormer said in REGEX: a single line should contain each word in a paragraph.:
Maybe I’m missing the point
The point you may be missing is that the OP probably has a lot of data to act upon, making doing it “by hand” impractical.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login