A regular expression to match a new line (linebreaks).
Note that Linux uses \n
for a new-line, Windows \r\n
, and old Macs \r
.
/[\r\n]+/
The regex above also matches multiple consecutive new lines. Use the following regex to fix that:
/(\r\n|\r|\n)/
Rate This Regex
User Review
( votes)Expression Flags
Flags | Description |
---|---|
i |
Ignore case sensitive. |
g |
Allows global search. |
m |
Allows multiline search. |