Javascript examples for RegExp:Bracket
Do a global, case-insensitive search for the character-span [a-s]:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//ww w . ja va 2s . co m var str = "The following code shows how to "; var patt1 = /[a-s]/gi; var result = str.match(patt1); document.getElementById("demo").innerHTML = result; } </script> </body> </html>