用字符串属性做提取 let str = 'www.baidu.com' str.search('baidu') str.replace('www.', '') str.replace('.com', '')