Is it possible in JavaScript to do something like preg_match_all does in PHP ?
I would like to be able to get two numbers from string:
var text = 'b463_z78';
into two separated variables:
var bannerID = 463;
var zoneID = 78;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use this
Assuming that the input string is strictly: start with
b, digits, then underscore_, thenz, then end with digits.The 2 numbers are in index 1 and index 2 of the returned array.