Easy Tutorial
❮ Jsref Anchor Prop Audio Networkstate ❯

JavaScript RegExp \n Meta Character


Definition and Usage

The \n meta character is used to find a newline character.

It returns the position where the newline character is found. If no match is found, it returns -1.

Syntax


Browser Support

All major browsers support the \n meta character.


Example

Search for a newline character in a string:

The text marked below shows where the expression matches:

Visit tutorialpro.\nLearn Javascript.

❮ Jsref Anchor Prop Audio Networkstate ❯