Javascript examples for RegExp:Quantifier
The n$ quantifier matches any string at the end of it.
Use the ^n quantifier to match any string with n at the BEGINNING of it.
The following code shows how to Do a global search for "is" at the end of a string:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from w ww. j a v a 2s. c om var str = "Is this his"; var patt1 = /is$/g; var result = str.match(patt1); document.getElementById("demo").innerHTML = result; } </script> </body> </html>