我是正则表达式的新手,
有人可以为我解释一下这些模式吗:
(<form[^\a]*</form>|<FORM[^\a]*</FORM>)
(method="[a-zA-Z]*|METHOD="[a-zA-Z]*)
答案1
答案2
从https://myregextester.com/index.php#(在字段中输入模式Match pattern
并确保已勾选Explain
。然后单击Submit):
----------------------------------------------------------------------
( group and capture to \1:
----------------------------------------------------------------------
<form '<form'
----------------------------------------------------------------------
[^\a]* any character except: '\a' (alarm) (0 or
more times (matching the most amount
possible))
----------------------------------------------------------------------
</form> '</form>'
----------------------------------------------------------------------
| OR
----------------------------------------------------------------------
<FORM '<FORM'
----------------------------------------------------------------------
[^\a]* any character except: '\a' (alarm) (0 or
more times (matching the most amount
possible))
----------------------------------------------------------------------
</FORM> '</FORM>'
----------------------------------------------------------------------
) end of \1
----------------------------------------------------------------------
'\r\n'
----------------------------------------------------------------------
( group and capture to \2:
----------------------------------------------------------------------
method=" 'method="'
----------------------------------------------------------------------
[a-zA-Z]* any character of: 'a' to 'z', 'A' to 'Z'
(0 or more times (matching the most
amount possible))
----------------------------------------------------------------------
| OR
----------------------------------------------------------------------
METHOD=" 'METHOD="'
----------------------------------------------------------------------
[a-zA-Z]* any character of: 'a' to 'z', 'A' to 'Z'
(0 or more times (matching the most
amount possible))
----------------------------------------------------------------------
) end of \2
----------------------------------------------------------------------
'\r\n'
----------------------------------------------------------------------
) end of grouping
----------------------------------------------------------------------