Regular Expressions 101

Community Patterns

Replace \n by <br />

2

Regular Expression
ECMAScript (JavaScript)

/
(\n|\\n)(?!$)
/
g

Description

Replace non-ending string \n by the <br /> HTML tag

Submitted by anonymous - 10 years ago