Error details:
Found that Google and 360 browsers work fine, but on Firefox it reports an error: SyntaxError: invalid regexp group
The reason for the error: my regularization is useful – —?& lt=
eg.(?<=(?:TianYe))[\u4e00-\u9fa5]{2} ------ Regular match for 2 Chinese characters starting with (TianYe) and ending with (TianYe).
// (? <=(? :TianYe)) ------ matches strings starting with (TianYe) and is not captured (not stored) in the group;
// [\u4e00-\u9fa5] ------ matches Chinese characters;
// {2} ------- matches 2 characters.
Root cause:
Firefox does not support prior assertion(lookahead)
Solutions:
Match it first, and then slice(0,2) it later.