uniapp 截取某个元素前面的数字
var s=150元/分钟var targetElement = "元/分钟";var regex = new RegExp("(\\d+\\.\\d+)"+targetElement);var result = s.match(regex);console.log(result);if (result && result.length > 1) {var number = result[1];return number+'元/分'}else{return "无"}