Javascript examples for RegExp:Match Number
Find number inside [] with regex
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=( function() {//from ww w . ja va 2s. co m var string = "[Name_is][234]" var matches = string.match(/\[(\d+)]/); if (matches.length) { var num = matches[1]; console.log(num); } }); </script> </head> <body> </body> </html>