1
learnshare 2015-09-15 14:21:27 +08:00
IPv4 `/^(((25[0-5])|(2[0-4]\d )|(1?\d{1,2}))\.){3}((25[0-5])|(2[0-4]\d )|(1?\d{1,2}))$/`
https://jex.im/regulex/#!embed=false&flags=&re=%5E (((25%5B0-5%5D )%7C (2%5B0-4%5D%5Cd )%7C (1%3F%5Cd%7B1%2C2%7D ))%5C.)%7B3%7D ((25%5B0-5%5D )%7C (2%5B0-4%5D%5Cd )%7C (1%3F%5Cd%7B1%2C2%7D ))%24 |
2
learnshare 2015-09-15 14:21:58 +08:00
手动复制第二行开始至结尾的 URL
|
3
wlee1991 OP this one really ... sucks ...
(\\d{1}|[1-9]{1}\\d{1}|1{1}\\d{1}\\d{1}|2{1}[0-5]{1}[0-5]{1})\\.(\\d{1}|[1-9]{1}\\d{1}|1{1}\\d{1}\\d{1}|2{1}[0-5]{1}[0-5]{1})\\.(\\d{1}|[1-9]{1}\\d{1}|1{1}\\d{1}\\d{1}|2{1}[0-5]{1}[0-5]{1})\\.(\\d{1}|[1-9]{1}\\d{1}|1{1}\\d{1}\\d{1}|2{1}[0-5]{1}[0-5]{1}) |
4
wlee1991 OP @learnshare
复制了,貌似不起作用?怎么那么多%? |
5
learnshare 2015-09-15 15:00:46 +08:00
直接去 https://jex.im/regulex/ 填入下面这一行吧
/^(((25[0-5])|(2[0-4]\d )|(1?\d{1,2}))\.){3}((25[0-5])|(2[0-4]\d )|(1?\d{1,2}))$/ |
6
Ryans 2015-09-15 15:01:54 +08:00
([0-9]{1,3}[\.]){3}[0-9]{1,3}
|
8
18000rpm 2015-09-15 17:36:31 +08:00
写正则不分行不给注释叫优雅?
|
9
learnshare 2015-09-15 17:53:58 +08:00
@18000rpm 不是给了图形化的展示了么
|
10
18000rpm 2015-09-15 18:51:19 +08:00
|
11
gamexg 2015-09-15 19:03:27 +08:00
|
14
msg7086 2015-09-15 21:45:42 +08:00
优雅地匹配 IP 最好别用正则而是用库。
|
15
ob 2015-09-15 21:58:31 +08:00 via Android
优雅被用坏了。。😃
|
16
virusdefender 2015-09-15 22:47:31 +08:00
django 的正则
ipv4_re = re.compile (r'^(25[0-5]|2[0-4]\d|[0-1]?\d?\d )(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d )){3}\Z') |
17
wlee1991 OP @virusdefender 你这个...貌似也不怎么优雅呀...
|