I'm going to mask words with regex.
The detection results are as follows.
regex: (?<=.{2}).*(?=.{3})
word : AABBCCC
Result : BB
Use the following code to function normally as shown below.
word.match(new RegExp(regex, 'gi')).forEach(v => {
word = word.replace(v, '*'.repeat(v.length));
});
Result: AA**CCC
But If the word is BBBBCCC, Result is **BBCCC I want to BB**CCC, How can I get the results I want?