var text = '||||||03'; var matches = text.match(/\|\|\|\|\|\|(\d{2})/); console.log(matches[1]); // 03