1.假设IP地址是规范的,没有出错误的 sed -n "/[0-9]\{1,3\}.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/p" test 这种匹配存在明显的问题,在正则匹配的过程中,若是出现300,1,255,0:192.168.0. :192.168,1.1.1这种错误的IP地址,任然会被匹配到 2.IP地址规范与否未知的情况下匹配 在这里,逛论坛的时候看见一位老哥踩了一个坑,这里做 一下记录 sed -n -r "/((([0…
p = re.compile('^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$') if p.match(domain): current_app.logger.info('detect ip domain: {0}'.format(domain)) return 'ip…
* 在使用前,一定要注意在头部加上引用: using System.Net; 代码如下: using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Console.Write(new P…