To find a new line character with JavaScript Regular Expression, use the following −
\n
Example
You can try to run the following code to find a new line character. It returns the position where the new line (\n) is found −
<html> <head> <title>JavaScript Regular Expression</title> </head> <body> <script> var myStr = "UI \n Responsive!"; var reg = /\n/; var match = myStr.search(reg); document.write(match); </script> </body> </html>