JavaScript has a RegExp
object which does what you want. The String
object has a match()
function that will help you out.
var matches = text.match(/price\[(\d+)\]\[(\d+)\]/);
var productId = matches[1];
var shopId = matches[2];
JavaScript has a RegExp
object which does what you want. The String
object has a match()
function that will help you out.
var matches = text.match(/price\[(\d+)\]\[(\d+)\]/);
var productId = matches[1];
var shopId = matches[2];