更新时间:2023-09-04 09:43:34
您可以先检查单词边界(当你正在做的事情,但由于。
,棘手的部分是在最后你不能使用单词边界。但是,您可以在最后检查空格字符:
You can check for the word boundary first (as you were doing), but the tricky part is at the end where you can't use the word boundary because of the .
. However, you can check for a whitespace character at the end instead:
/\b(u\.s\.a\.)(?:\s|$)/gi
查看 Regex101