更新时间:2023-02-26 11:25:24
如果我理解正确,这应该是一种可能的解决方案:
If I understand you correctly, this should be one possible solution:
'aforementioned'.replace(new RegExp(pattern + '|.', 'gi'), function(c) {
return c === pattern ? c : '*';
});
>> "*fore*********"