RegExp \v Metacharacter - Javascript RegExp

Javascript examples for RegExp:Metacharacter

Description

The \v metacharacter returns the position where the vertical tab character was found. If no match is found, it returns -1.

The following code shows how to Search for a vertical tab character in a string:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {/*www  .j a va2 s  .  c om*/
    var str = "check out java2s.com.\vLearn JavaScript.";
    var patt1 = /\v/;
    var result = str.search(patt1);
    document.getElementById("demo").innerHTML = result;
}
</script>

</body>
</html>

Related Tutorials