Javascript examples for RegExp:RegExp Match
Use regex to match multiple word with spaces/multiple space or no spaces
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=( function() {/* w w w. j a va 2 s . c o m*/ var string="Hi I am bob \ hi \ Hi I am Bob"; var regex=/\b\w+\b/g; var results=string.match(regex); document.write(results.join("<br/>")); }); </script> </head> <body> </body> </html>