常用正则匹配

在线测试

mac地址

/^[A-F0-9]{2}(-[A-F0-9]{2}){5}$|^[A-F0-9]{2}(:[A-F0-9]{2}){5}$/
Mac地址有两种:
    58:E8:76:83:A2:C7
    /^[A-Fa-f0-9]{1,2}\:[A-Fa-f0-9]{1,2}\:[A-Fa-f0-9]{1,2}\:[A-Fa-f0-9]{1,2}\:[A-Fa-f0-9]{1,2}\:[A-Fa-f0-9]{1,2}$/
 
    58-E8-76-83-A2-C7
   /^[A-Fa-f0-9]{1,2}\-[A-Fa-f0-9]{1,2}\-[A-Fa-f0-9]{1,2}\-[A-Fa-f0-9]{1,2}\-[A-Fa-f0-9]{1,2}\-[A-Fa-f0-9]{1,2}$/
简写后:
   /^[A-F0-9]{2}(-[A-F0-9]{2}){5}$/
   /^[A-F0-9]{2}(:[A-F0-9]{2}){5}$/

ip地址

/^(\d|[1-9]\d|1\d{2}|2[0-5][0-5])\.(\d|[1-9]\d|1\d{2}|2[0-5][0-5])\.(\d|[1-9]\d|1\d{2}|2[0-5][0-5])\.(\d|[1-9]\d|1\d{2}|2[0-5][0-5])$/
上一篇:Ulysses 22 发布功能加强,允许自定义分组颜色


下一篇:Ulysses 22 发布功能加强,允许自定义分组颜色