📜  如果符号前后是单词字符 js - Javascript 代码示例,则替换符号

📅  最后修改于: 2022-03-11 15:01:54.107000             🧑  作者: Mango

代码示例1
This Works to find when a word is followed by another chars
string.match(/word([^s]|^)/) 

You can use ([^s]|^) before or after the word.

Cases: 
If the word has other char/word before it the code is:
string.match(/([^s]|^)word/)
If the word has other char/word after it the code is:
string.match(/word([^s]|^)/)