如下所示,所有释义中的每一行都未完成。段落中每行开头的单词不是上一行的延续。我感兴趣的是在没有任何断字的情况下连接释义中的所有行。
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.
输出
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.
我的正则表达式效果不是很好:
寻找:^(.*?)$(\K.*)\r
替换为:\2
或者(一个更好的)
寻找:^(.*?)$(\R)
替换为:\1
使用 Notepad++,可能与 SublimeText 一起使用。
\R+_.+_\R+(*SKIP)(*FAIL)|\R
. matches newline
解释:
屏幕截图(之前):
截图(之后):
一个非常简单有用的正则表达式公式:
寻找:
([^\r\n])\R([^\r\n])
替换为:
\1 \2
\R(?=.)
(leave empty)
. matches newline