Javascript examples for RegExp:Quantifier
The ?=n quantifier matches any string that is followed by a specific string n.
Use the ?!n quantifier to match any string that is NOT followed by a specific string n.
The following code shows how to Do a global search for "is" followed by " all":
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {// w ww. ja v a2s . c o m var str = "Is this all there is The following code shows how to "; var patt1 = /is(?= all)/; var result = str.match(patt1); document.getElementById("demo").innerHTML = result; } </script> </body> </html>