【发布时间】:2020-03-22 15:31:49
【问题描述】:
案例一:
示例 html:<a href="https://www.jessussaveme.com/saveme/c-from.html?random[for_god_sake_save_me]=anyonethere&no=fr&lang=fr">Test</a>
预期输出:
https://www.jessussaveme.com/saveme/c-from.html?random[for_god_sake_save_me]=anyonethere&no=fr&lang=fr
案例2:
示例 html:<a href="https://www.jessussaveme.com/saveme/c-from.html?random[]=anyonethere&no=fr&lang=fr">Test</a>
预期输出:没有。链接不应包含空方括号 []
案例3:
示例 html:<a href="https://www.jessussaveme.com/saveme/c-from.html?random=anyonethere&no=fr&lang=fr">Test</a>
预期输出:https://www.jessussaveme.com/saveme/c-from.html?random=anyonethere&no=fr&lang=fr
应选择哪些链接: 1.不包含任何方括号'[]'的链接 或 2. 包含非空方括号'[Some_random_text]'的链接
不应选择的链接: 包含空方括号 [] 的链接。
【问题讨论】:
-
RegEx 不适合解析 HTML:stackoverflow.com/a/1732454/800214
标签: php regex regex-lookarounds regex-group