const string = 'Current order (day 1) is created and send ..'; const value = /\(\s*day\s*(\d+)\s*\)/.test(string) && Number(RegExp.$1); alert(value);