let myString = 'No Status: not enough information to provide one. more research and data-gathering is required.';
let newString = myString.replace('not enough information to provide one. ', '');
console.log(newString);
或 * with regex:
let myString = 'No Status: not enough information to provide one. more research and data-gathering is required.';
let newString = myString.replace(/:.*?\./, ':');
console.log(newString);
1条答案
按热度按时间jm2pwxwz1#
简单的字符串替换不需要正则表达式: