我已经通过grunt生成了一个min文件,它在新的Wordpress 5.7版本中给出了一个错误。
下面显示了此错误未捕获的语法错误:无效的正则表达式:/^(?:[\d]+|me$/:未终止的组。
当我转到源文件时,我得到了一个new RegExp(j?"^"+j+"$":d,"i");
我删除了代码,它正在部分工作。所以我需要用正确的语法来改变它。请让我知道什么是正确的语法而不是这个。
提前谢谢。
添加)
,使用
/^(?:d+|me)$/i
// ^
此外,[d]
=d
。请参阅正则表达式证明。
解释
--------------------------------------------------------------------------------
^ the beginning of the string
--------------------------------------------------------------------------------
(?: group, but do not capture:
--------------------------------------------------------------------------------
d+ digits (0-9) (1 or more times (matching
the most amount possible))
--------------------------------------------------------------------------------
| OR
--------------------------------------------------------------------------------
me 'me'
--------------------------------------------------------------------------------
) end of grouping
--------------------------------------------------------------------------------
$ before an optional n, and the end of the
string