我正在将一些库从PHP移植到JavaScript,我遇到了这个正则表达式,其中一些部分对我来说不清楚.
#(?: *+(?<= |^)\.((?:\([^)\n]++\)|\[[^\]\n]++\]|\{[^}\n]++\}|<>|>|=|<){1,4}?))#
Run Code Online (Sandbox Code Playgroud)
不清楚的部分是
*+++我知道,这个表达应该接受像这样的字符串
.(title)[class]{style}<>
.[class]{style}<>
.[class](title){style}
// and so one - no metter of order \(.+\), \[.+\] and \{.+\} parts
// and optional <>, >, = or < at the end
Run Code Online (Sandbox Code Playgroud)
谢谢你的解释.
编辑:此表达式与PCRE_UNGREEDY修饰符一起使用