Check that Hashtag word must start with a space - Javascript RegExp

Javascript examples for RegExp:Match Space

Description

Check that Hashtag word must start with a space

Demo Code

ResultView the demo in separate window

<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 text = document.getElementsByTagName('p')[0].innerHTML;
document.body.innerHTML += /\s#([A-Za-z0-9_]+\b)/.exec(text)[0];
    }

      </script> 
   </head> 
   <body> 
      <p>some text #hashtag more text.</p>  
   </body>
</html>

Related Tutorials