更新时间:2023-02-17 23:14:30
我最近有同样的问题。正则表达式使用ascii操作,因此不会识别特殊字符,如é
或ß
。您需要明确地将这些包含到您的正则表达式中。
I had the same problem recently. Regex operates with ascii, therefor special characters like é
or ß
are not recognized. You need to explicitely include those into your regex.
使用此:
Use this:
var regex = /[ée]po/gi;
提示:不要使用 new Regex()
它很慢,但直接声明正则表达式。这也解决了一些引用/转义问题。
Hint: Don't use new Regex()
it's rather slow, but declare the regex directly instead. This also solves some quoting/escaping issues.