我尝试构建一个前瞻性正则表达式来匹配一个网址,但前提是它同时包含action=upgrade
和result=success
作为查询字符串参数。
匹配的示例:
http://example.com/account/?result=success&action=upgrade#some_anchor
http://example.com/account/?action=upgrade&result=success#some_anchor
我在Rubular尝试了这个,但它没有用:
答案 0 :(得分:1)
试试这个:
^https(?=.*\bresult=success\b)(?=.*\baction=upgrade\b).*
进行测试你可以在这里试试:http://rubular.com/r/hXYcRL1lSw我只测试了你的例子。