Regex 正则表达式负前瞻
我需要修改这个正则表达式Regex 正则表达式负前瞻,regex,negative-lookahead,regex-lookarounds,Regex,Negative Lookahead,Regex Lookarounds,我需要修改这个正则表达式 href=\"(.*)\" 哪个和这个匹配 href="./pothole_locator_map.aspx?lang=en-gb&lat=53.153977&lng=-3.533306" 与此不匹配 href="./pothole_locator_map.aspx?lang=en-gb&lat=53.153977&lng=-3.533306&returnurl=AbandonedVehicles.aspx" 我试过了,但是
href=\"(.*)\"
哪个和这个匹配
href="./pothole_locator_map.aspx?lang=en-gb&lat=53.153977&lng=-3.533306"
与此不匹配
href="./pothole_locator_map.aspx?lang=en-gb&lat=53.153977&lng=-3.533306&returnurl=AbandonedVehicles.aspx"
我试过了,但是运气不好
href=\"(.*)\"(?!&returnurl=AbandonedVehicles.aspx)
任何帮助都将不胜感激
谢谢,
Al.应在匹配使用字符串之前放置Lookaheads,即
href=\"(?!.*&returnurl=AbandonedVehicles\.aspx)(.*)\"
URL参数未排序,因此您必须能够处理
/pothore\u locator\u map.aspx?lang=en gb&returnurl=弃置车辆。aspx&lat=53.153977&lng=-3.533306
和其他变体。为什么不检查GET参数“returnurl”的存在性呢?
href="(?!.*returnurl=AbandonedVehicles\.aspx)(.*)"