有人可以解释一下这个正则表达式吗?
^(?=.*prodCode=).*$
Run Code Online (Sandbox Code Playgroud)
NODE EXPLANATION
--------------------------------------------------------------------------------
^ the beginning of the string
--------------------------------------------------------------------------------
(?= look ahead to see if there is:
--------------------------------------------------------------------------------
. any character except \n
--------------------------------------------------------------------------------
prodCode= 'prodCode='
--------------------------------------------------------------------------------
) end of look-ahead
--------------------------------------------------------------------------------
. any character except \n
--------------------------------------------------------------------------------
$ before an optional \n, and the end of the string
Run Code Online (Sandbox Code Playgroud)
编辑
由于问题文本中的正则表达式已更改,因此解释中的倒数第二行将更改为:
--------------------------------------------------------------------------------
.* any character except \n (0 or more times (matching
the most amount possible))
--------------------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
136 次 |
| 最近记录: |