<html>
<body>
<h1>JavaScript Regular Expression</h1>
<h2>The n Metacharacter</h2>
<p>Find the position where a newline character is found:</p>
<p id="demo"></p>
<script>
let text = "Visit W3Schools.\nLearn JavaScript.";
let pattern = /\n/;
let result = text.search(pattern);
document.getElementById("demo").innerHTML = result;
</script>
</body>
</html>