wyc
wyc

Reputation: 55323

What's the difference between matching \n and \n\n?

For some reason, I couldn't find this information anywhere.

Let's say I have some dummy text:

Line 1

Line 2

Line 3

What would be the difference between matching \n and \n\n?

Is it like this?

Line 1\n
\n
Line 2

Line 3

Or like this?

\nLine 1
\n
Line 2

Line 3

Or like this?

Line 1
\n
\n
Line 2

Line 3

https://regexr.com/64jeh

Upvotes: 0

Views: 54

Answers (1)

it should be straight forward, one \n means one new line, two \n\n means two new lines, depends on use cases if you want to remove all newlines in text just use \n+

Upvotes: 5

Related Questions