Javascript examples for RegExp:Bracket
The [^abc] expression matches any character NOT between the brackets.
For example,
[abc] expression matches any character between the brackets.
The following code shows how to Do a global search for characters that are NOT inside the brackets [h]:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from w ww . j a v a 2 s . 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>