I have a regex that I run on a text to remove digits before a “.” as well as some random characters that may appear after it. This regex matches everything i need it to match which I confirmed in regex101.com. However when I pass it to my javascript function as a parameter to the replaceAll() function, the text returned still has some numbers at the end. After countless hours searching online, i still don’t understand why this is happening. Does anyone know the cause?
Regex entered in regex101.com
(^[+-]?d+(.|s|-|)|(s-.)|(s.)?)+(^dd|[^u4E00-u9FA5|a-zA-Z|/:«»|0-9|();n]|d*[.])
Sample text:
11.君曰
1100.君曰
11.君曰
情奴(新版)
我在未来等着你
11.君曰
11.君曰
11678.君曰
11- -.情海孤舟
11 爱 .情海孤舟
Current output from my js function
updatedText = updatedText.replaceAll(/(^[+-]?d+(.|s|-|)|(s-.)|(s.)?)+(^dd|[^u4E00-u9FA5|a-zA-Z|/:«»|0-9|();n]|d*[.])/g, "");
output:
君曰
君曰
君曰
情奴(新版)
我在未来等着你
君曰
君曰
君曰
11情海孤舟
11爱情海孤舟
Any help in explaining why the 11’s are still in the output would be awesome! Thanks in advance.