Use Regular Expressions to Find digits in last part of string - Javascript RegExp

Javascript examples for RegExp:Match Number

Description

Use Regular Expressions to Find digits in last part of string

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 .  ja v a2  s. c o m*/
var regex = new RegExp(/\(ID: ([0-9]+)\)/);
var test = "Some kind of title (ID: 3456)";
var match = regex.exec(test);
console.log('Found: ' + match[1]);
    });

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

Related Tutorials