Javascript examples for RegExp:Metacharacter
The \f metacharacter returns the position where the form feed character was found. If no match is found, it returns -1.
The following code shows how to Search for a form feed character in a string:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from w w w . java 2 s.c o m var str = "Visit java2s.com.\fLearn JavaScript."; var patt1 = /\f/; var result = str.search(patt1); document.getElementById("demo").innerHTML = result; } </script> </body> </html>