Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
r"
(.)\n(?!\n)
"
g
Input 1
New
I have a text file where lines are trimmed by newline characters. I want to strip out those single newlines and replace with simple spaces. But I do not want the double newlines affected. This line should start after 2 line breaks. Everything I try inevitably ends up affecting those double new lines too. This line should also start after 2 line breaks. This can be solved using lookaheads.
Extraction
I have a text file where lines are trimmed by newline characters. I want to strip out those single newlines and replace with simple spaces. But I do not want the double newlines affected. This line should start after 2 line breaks. Everything I try inevitably ends up affecting those double new lines too. This line should also start after 2 line breaks. This can be solved using lookaheads.