Javascript examples for RegExp:Metacharacter
The \s metacharacter matches a whitespace character.
A whitespace character can be:
The following code shows how to Do a global search for whitespace characters in a string:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*w w w.j a v a2 s. c o m*/ var str = "The following code shows how to Is this all there is?"; var patt1 = /\s/g; var result = str.match(patt1); document.getElementById("demo").innerHTML = result; } </script> </body> </html>