Get two parts of a string after using regex matching - Javascript RegExp

Javascript examples for RegExp:RegExp Match

Description

Get two parts of a string after using regex matching

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  v  a  2  s . co m*/
  var something="a<b>pple</b>";
  var the_string = something.split(/\<\/?b\>/);
  console.log(the_string[0] + ", " + the_string[1]);
});

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials