两个IP地址匹配
我需要用正则表达式匹配两个ip地址: 像20.20.20.20两个IP地址匹配
should match with 20.20.20.20
should match with [http://20.20.20.20/abcd]
should not match with 20.20.20.200
should not match with [http://20.20.20.200/abcd]
should not match with [http://120.20.20.20/abcd]
目前我使用这样的正则表达式:".*[^(\d)]20.20.20.20[^(\d)].*"
但它无法正常工作为第一和第三个case.Please帮助我这个正则表达式。
你忽略的情况下,一些 其中行开头20.20.20.20:
"(.*[^(\d)]|^)20.20.20.20([^(\d)].*|$)"
似乎为我
0123工作
你可以这样说:
select * from tablename
where ip = '20.20.20.20' or ip like 'http://20.20.20.20/%'
你的解决方案是好的,但看看标签,我认为他想要一个正则表达式。 –
@cad有可能,让我们看看OP说的是什么。 –
你是对的,也许他可以将逻辑移动到查询:) –
感谢您的解决方案:) – user1479571