0

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.*)\r

REPLACE BY: \2

OR (a better one)

FIND: ^(.*?)$(\R)

REPLACE BY: \1

3 Answers 3

1

Using Notepad++, may be it works with SublimeText.


  • Ctrl+H
  • Find what: \R+_.+_\R+(*SKIP)(*FAIL)|\R
  • Replace with: # A space
  • TICK Wrap around
  • SELECT Regular expression
  • UNTICK . matches newline
  • Replace all

Explanation:

\R+         # 1 or more any kind of linebreak
_.+_        # 1 or more any character surounded by underscores
\R+         # 1 or more any kind of linebreak
(*SKIP)     # skip this match
(*FAIL)     # and considere it failed
|           # OR
\R          # any kind of linebreak

Screenshot (before):

enter image description here

Screenshot (after):

enter image description here

0

A very simple and useful regex formula:

FIND: ([^\r\n])\R([^\r\n])

REPLACE BY: \1 \2

0
  • Ctrl+H
  • Find what: \R(?=.)
  • Replace with: (leave empty)
  • CHECK Wrap around
  • CHECK Regular expression
  • UNCHECK . matches newline
  • Replace all
2
  • 1
    This removes lines above and under titles, i.e.: _Artificial Illuminations._
    – Toto
    Commented Jun 16, 2023 at 11:46
  • yes, I see now. It is not perfect my regex, but it can be a starting point.
    – Just Me
    Commented Jun 16, 2023 at 16:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .