const str = 'one 2 three 4';
const index = str.search(/[0-9]/);
console.log(index);
const firstNum = Number(str[index]);
console.log(firstNum);
Get desired variables from string using JavaScript and get different variables from string using JavaScript
/AP(\d+|(\["\d+\"]))\.\RSV\d+', 'AP2.RSV3-AP1.RSV3=3 OR AP["234"].RSV3+AP3.RSV22=3/.test("The best things in life are free!");