Reputation: 323
I want to delete unnecessary line breaks within paragraphs in vs code.
I tried [^\n\r]([\r\n])[^\n\r]
, but I cannot figure out how to capture the right line break in vs code.
The original text is
Monster Magnet 和
Kyuss
那样的乐队,完美地契合了90年代早期另类金属运动的电子乐口味。即使是在
grunge 风格已经褪色,而工业和
hip-hop
的影响也开始加诸于另类金属的时候,stoner
metal 依然是进入新世纪以来深受推崇的一种风格。
Stoner metal is a subgenre of metal music that combines elements of doom
metal with elements of psychedelic rock and blues rock to create a
melodic yet heavy sound. Like stoner metal's close relative genre stoner
The expected result is
Monster Magnet 和 Kyuss 那样的乐队,完美地契合了90年代早期另类金属运动的电子乐口味。即使是在 grunge 风格已经褪色,而工业和 hip-hop 的影响也开始加诸于另类金属的时候,stoner metal 依然是进入新世纪以来深受推崇的一种风格。
Stoner metal is a subgenre of metal music that combines elements of doom metal with elements of psychedelic rock and blues rock to create a melodic yet heavy sound. Like stoner metal's close relative genre stoner
Upvotes: 1
Views: 232
Reputation: 18621
Use
(?<!\n)\n(?!\n)
Replace with a space. See proof.
Explanation
--------------------------------------------------------------------------------
(?<! look behind to see if there is not:
--------------------------------------------------------------------------------
\n '\n' (newline)
--------------------------------------------------------------------------------
) end of look-behind
--------------------------------------------------------------------------------
\n '\n' (newline)
--------------------------------------------------------------------------------
(?! look ahead to see if there is not:
--------------------------------------------------------------------------------
\n '\n' (newline)
--------------------------------------------------------------------------------
) end of look-ahead
Upvotes: 3