• js IPV4 IPV6 正则验证表达式


    IPV4

     ^((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)$
    

      

    IPV6

    ^([da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)$|^::([da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)$|^([da-fA-F]{1,4}:):([da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)$|^([da-fA-F]{1,4}:){2}:([da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)$|^([da-fA-F]{1,4}:){3}:([da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)$|^([da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)$|^([da-fA-F]{1,4}:){7}[da-fA-F]{1,4}$|^:((:[da-fA-F]{1,4}){1,6}|:)$|^[da-fA-F]{1,4}:((:[da-fA-F]{1,4}){1,5}|:)$|^([da-fA-F]{1,4}:){2}((:[da-fA-F]{1,4}){1,4}|:)$|^([da-fA-F]{1,4}:){3}((:[da-fA-F]{1,4}){1,3}|:)$|^([da-fA-F]{1,4}:){4}((:[da-fA-F]{1,4}){1,2}|:)$|^([da-fA-F]{1,4}:){5}:([da-fA-F]{1,4})?$|^([da-fA-F]{1,4}:){6}:$
    

      

    IPV4/IPV6

    ^((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)$|^([da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)$|^::([da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)$|^([da-fA-F]{1,4}:):([da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)$|^([da-fA-F]{1,4}:){2}:([da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)$|^([da-fA-F]{1,4}:){3}:([da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)$|^([da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)$|^([da-fA-F]{1,4}:){7}[da-fA-F]{1,4}$|^:((:[da-fA-F]{1,4}){1,6}|:)$|^[da-fA-F]{1,4}:((:[da-fA-F]{1,4}){1,5}|:)$|^([da-fA-F]{1,4}:){2}((:[da-fA-F]{1,4}){1,4}|:)$|^([da-fA-F]{1,4}:){3}((:[da-fA-F]{1,4}){1,3}|:)$|^([da-fA-F]{1,4}:){4}((:[da-fA-F]{1,4}){1,2}|:)$|^([da-fA-F]{1,4}:){5}:([da-fA-F]{1,4})?$|^([da-fA-F]{1,4}:){6}:$
    

      

    IPV4 + mask

    ^((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/(d|[1-2]d|3[0-2]))?$
    

      

    IPV6 + mask

    ^([da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^::([da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^([da-fA-F]{1,4}:):([da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^([da-fA-F]{1,4}:){2}:([da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^([da-fA-F]{1,4}:){3}:([da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^([da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^([da-fA-F]{1,4}:){7}[da-fA-F]{1,4}(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^:((:[da-fA-F]{1,4}){1,6}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^[da-fA-F]{1,4}:((:[da-fA-F]{1,4}){1,5}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^([da-fA-F]{1,4}:){2}((:[da-fA-F]{1,4}){1,4}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^([da-fA-F]{1,4}:){3}((:[da-fA-F]{1,4}){1,3}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^([da-fA-F]{1,4}:){4}((:[da-fA-F]{1,4}){1,2}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^([da-fA-F]{1,4}:){5}:([da-fA-F]{1,4})?(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^([da-fA-F]{1,4}:){6}:(/([1-9]?d|(1([0-1]d|2[0-8]))))?$
    

      

    IPV4/IPV6 + mask

    ^((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/(d|[1-2]d|3[0-2]))?$|^([da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^::([da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^([da-fA-F]{1,4}:):([da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^([da-fA-F]{1,4}:){2}:([da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^([da-fA-F]{1,4}:){3}:([da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^([da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^([da-fA-F]{1,4}:){7}[da-fA-F]{1,4}(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^:((:[da-fA-F]{1,4}){1,6}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^[da-fA-F]{1,4}:((:[da-fA-F]{1,4}){1,5}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^([da-fA-F]{1,4}:){2}((:[da-fA-F]{1,4}){1,4}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^([da-fA-F]{1,4}:){3}((:[da-fA-F]{1,4}){1,3}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^([da-fA-F]{1,4}:){4}((:[da-fA-F]{1,4}){1,2}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^([da-fA-F]{1,4}:){5}:([da-fA-F]{1,4})?(/([1-9]?d|(1([0-1]d|2[0-8]))))?$|^([da-fA-F]{1,4}:){6}:(/([1-9]?d|(1([0-1]d|2[0-8]))))?$
    

      

    IPV4-IPV4

    ^((((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))-(((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)))$
    

      

    IPV6-IPV6

    ^(((([da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(::([da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:):([da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){2}:([da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){3}:([da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){7}[da-fA-F]{1,4})|(:((:[da-fA-F]{1,4}){1,6}|:))|([da-fA-F]{1,4}:((:[da-fA-F]{1,4}){1,5}|:))|(([da-fA-F]{1,4}:){2}((:[da-fA-F]{1,4}){1,4}|:))|(([da-fA-F]{1,4}:){3}((:[da-fA-F]{1,4}){1,3}|:))|(([da-fA-F]{1,4}:){4}((:[da-fA-F]{1,4}){1,2}|:))|(([da-fA-F]{1,4}:){5}:([da-fA-F]{1,4})?)|(([da-fA-F]{1,4}:){6}:))-((([da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(::([da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:):([da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){2}:([da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){3}:([da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){7}[da-fA-F]{1,4})|(:((:[da-fA-F]{1,4}){1,6}|:))|([da-fA-F]{1,4}:((:[da-fA-F]{1,4}){1,5}|:))|(([da-fA-F]{1,4}:){2}((:[da-fA-F]{1,4}){1,4}|:))|(([da-fA-F]{1,4}:){3}((:[da-fA-F]{1,4}){1,3}|:))|(([da-fA-F]{1,4}:){4}((:[da-fA-F]{1,4}){1,2}|:))|(([da-fA-F]{1,4}:){5}:([da-fA-F]{1,4})?)|(([da-fA-F]{1,4}:){6}:)))$
    

      

    IPV4-IPV4 或 IPV6-IPV6

    ^(((((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))-(((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)))|(((([da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(::([da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:):([da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){2}:([da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){3}:([da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){7}[da-fA-F]{1,4})|(:((:[da-fA-F]{1,4}){1,6}|:))|([da-fA-F]{1,4}:((:[da-fA-F]{1,4}){1,5}|:))|(([da-fA-F]{1,4}:){2}((:[da-fA-F]{1,4}){1,4}|:))|(([da-fA-F]{1,4}:){3}((:[da-fA-F]{1,4}){1,3}|:))|(([da-fA-F]{1,4}:){4}((:[da-fA-F]{1,4}){1,2}|:))|(([da-fA-F]{1,4}:){5}:([da-fA-F]{1,4})?)|(([da-fA-F]{1,4}:){6}:))-((([da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(::([da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:):([da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){2}:([da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){3}:([da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){7}[da-fA-F]{1,4})|(:((:[da-fA-F]{1,4}){1,6}|:))|([da-fA-F]{1,4}:((:[da-fA-F]{1,4}){1,5}|:))|(([da-fA-F]{1,4}:){2}((:[da-fA-F]{1,4}){1,4}|:))|(([da-fA-F]{1,4}:){3}((:[da-fA-F]{1,4}){1,3}|:))|(([da-fA-F]{1,4}:){4}((:[da-fA-F]{1,4}){1,2}|:))|(([da-fA-F]{1,4}:){5}:([da-fA-F]{1,4})?)|(([da-fA-F]{1,4}:){6}:))))$
    

      

    IPV4-IPV4 或 IPV6-IPV6 或 IPV6 + mask 或 IPV4 + mask

    ^(((((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))-(((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)))|(((([da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(::([da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:):([da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){2}:([da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){3}:([da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){7}[da-fA-F]{1,4})|(:((:[da-fA-F]{1,4}){1,6}|:))|([da-fA-F]{1,4}:((:[da-fA-F]{1,4}){1,5}|:))|(([da-fA-F]{1,4}:){2}((:[da-fA-F]{1,4}){1,4}|:))|(([da-fA-F]{1,4}:){3}((:[da-fA-F]{1,4}){1,3}|:))|(([da-fA-F]{1,4}:){4}((:[da-fA-F]{1,4}){1,2}|:))|(([da-fA-F]{1,4}:){5}:([da-fA-F]{1,4})?)|(([da-fA-F]{1,4}:){6}:))-((([da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(::([da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:):([da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){2}:([da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){3}:([da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){7}[da-fA-F]{1,4})|(:((:[da-fA-F]{1,4}){1,6}|:))|([da-fA-F]{1,4}:((:[da-fA-F]{1,4}){1,5}|:))|(([da-fA-F]{1,4}:){2}((:[da-fA-F]{1,4}){1,4}|:))|(([da-fA-F]{1,4}:){3}((:[da-fA-F]{1,4}){1,3}|:))|(([da-fA-F]{1,4}:){4}((:[da-fA-F]{1,4}){1,2}|:))|(([da-fA-F]{1,4}:){5}:([da-fA-F]{1,4})?)|(([da-fA-F]{1,4}:){6}:)))|(((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/(d|[1-2]d|3[0-2]))?)|((([da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(::([da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:):([da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){2}:([da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){3}:([da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){7}[da-fA-F]{1,4}(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(:((:[da-fA-F]{1,4}){1,6}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|([da-fA-F]{1,4}:((:[da-fA-F]{1,4}){1,5}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){2}((:[da-fA-F]{1,4}){1,4}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){3}((:[da-fA-F]{1,4}){1,3}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){4}((:[da-fA-F]{1,4}){1,2}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){5}:([da-fA-F]{1,4})?(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){6}:(/([1-9]?d|(1([0-1]d|2[0-8]))))?)))$
    

      

    多行匹配

    上面给出的都是单行正则匹配

    单行:

    ^a$|^b$
    

      等价于:

    ^((a)|(b))$
    

      多行正则匹配为

    ^(((a)|(b))[
    ])*((a)|(b))$
    

      

    多行 IPV4/IPV6 + mask

    ^(((((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/(d|[1-2]d|3[0-2]))?)|(([da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(::([da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:):([da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){2}:([da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){3}:([da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){7}[da-fA-F]{1,4}(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(:((:[da-fA-F]{1,4}){1,6}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|([da-fA-F]{1,4}:((:[da-fA-F]{1,4}){1,5}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){2}((:[da-fA-F]{1,4}){1,4}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){3}((:[da-fA-F]{1,4}){1,3}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){4}((:[da-fA-F]{1,4}){1,2}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){5}:([da-fA-F]{1,4})?(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){6}:(/([1-9]?d|(1([0-1]d|2[0-8]))))?))[
    ])*((((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/(d|[1-2]d|3[0-2]))?)|(([da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(::([da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:):([da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){2}:([da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){3}:([da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){7}[da-fA-F]{1,4}(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(:((:[da-fA-F]{1,4}){1,6}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|([da-fA-F]{1,4}:((:[da-fA-F]{1,4}){1,5}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){2}((:[da-fA-F]{1,4}){1,4}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){3}((:[da-fA-F]{1,4}){1,3}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){4}((:[da-fA-F]{1,4}){1,2}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){5}:([da-fA-F]{1,4})?(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){6}:(/([1-9]?d|(1([0-1]d|2[0-8]))))?))$
    

      以上正则表达式,就可匹配下面的 IP 组合

    1.1.1.1
    ::1
    2.2.2.2/24
    1::/16
    

      

    多行 IPV4/IPV6 不带子网前缀

    ^(((((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(::([da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:):([da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){2}:([da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){3}:([da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){7}[da-fA-F]{1,4})|(:((:[da-fA-F]{1,4}){1,6}|:))|([da-fA-F]{1,4}:((:[da-fA-F]{1,4}){1,5}|:))|(([da-fA-F]{1,4}:){2}((:[da-fA-F]{1,4}){1,4}|:))|(([da-fA-F]{1,4}:){3}((:[da-fA-F]{1,4}){1,3}|:))|(([da-fA-F]{1,4}:){4}((:[da-fA-F]{1,4}){1,2}|:))|(([da-fA-F]{1,4}:){5}:([da-fA-F]{1,4})?)|(([da-fA-F]{1,4}:){6}:))[
    ])*((((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(::([da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:):([da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){2}:([da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){3}:([da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){7}[da-fA-F]{1,4})|(:((:[da-fA-F]{1,4}){1,6}|:))|([da-fA-F]{1,4}:((:[da-fA-F]{1,4}){1,5}|:))|(([da-fA-F]{1,4}:){2}((:[da-fA-F]{1,4}){1,4}|:))|(([da-fA-F]{1,4}:){3}((:[da-fA-F]{1,4}){1,3}|:))|(([da-fA-F]{1,4}:){4}((:[da-fA-F]{1,4}){1,2}|:))|(([da-fA-F]{1,4}:){5}:([da-fA-F]{1,4})?)|(([da-fA-F]{1,4}:){6}:))$
    

      多行 IPV4-IPV4 或 IPV6-IPV6 或 IPV6 + mask 或 IPV4 + mask

    ^((((((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))-(((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)))|(((([da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(::([da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:):([da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){2}:([da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){3}:([da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){7}[da-fA-F]{1,4})|(:((:[da-fA-F]{1,4}){1,6}|:))|([da-fA-F]{1,4}:((:[da-fA-F]{1,4}){1,5}|:))|(([da-fA-F]{1,4}:){2}((:[da-fA-F]{1,4}){1,4}|:))|(([da-fA-F]{1,4}:){3}((:[da-fA-F]{1,4}){1,3}|:))|(([da-fA-F]{1,4}:){4}((:[da-fA-F]{1,4}){1,2}|:))|(([da-fA-F]{1,4}:){5}:([da-fA-F]{1,4})?)|(([da-fA-F]{1,4}:){6}:))-((([da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(::([da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:):([da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){2}:([da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){3}:([da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){7}[da-fA-F]{1,4})|(:((:[da-fA-F]{1,4}){1,6}|:))|([da-fA-F]{1,4}:((:[da-fA-F]{1,4}){1,5}|:))|(([da-fA-F]{1,4}:){2}((:[da-fA-F]{1,4}){1,4}|:))|(([da-fA-F]{1,4}:){3}((:[da-fA-F]{1,4}){1,3}|:))|(([da-fA-F]{1,4}:){4}((:[da-fA-F]{1,4}){1,2}|:))|(([da-fA-F]{1,4}:){5}:([da-fA-F]{1,4})?)|(([da-fA-F]{1,4}:){6}:)))|(((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/(d|[1-2]d|3[0-2]))?)|((([da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(::([da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:):([da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){2}:([da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){3}:([da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){7}[da-fA-F]{1,4}(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(:((:[da-fA-F]{1,4}){1,6}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|([da-fA-F]{1,4}:((:[da-fA-F]{1,4}){1,5}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){2}((:[da-fA-F]{1,4}){1,4}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){3}((:[da-fA-F]{1,4}){1,3}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){4}((:[da-fA-F]{1,4}){1,2}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){5}:([da-fA-F]{1,4})?(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){6}:(/([1-9]?d|(1([0-1]d|2[0-8]))))?)))[
    ])*(((((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))-(((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)))|(((([da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(::([da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:):([da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){2}:([da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){3}:([da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){7}[da-fA-F]{1,4})|(:((:[da-fA-F]{1,4}){1,6}|:))|([da-fA-F]{1,4}:((:[da-fA-F]{1,4}){1,5}|:))|(([da-fA-F]{1,4}:){2}((:[da-fA-F]{1,4}){1,4}|:))|(([da-fA-F]{1,4}:){3}((:[da-fA-F]{1,4}){1,3}|:))|(([da-fA-F]{1,4}:){4}((:[da-fA-F]{1,4}){1,2}|:))|(([da-fA-F]{1,4}:){5}:([da-fA-F]{1,4})?)|(([da-fA-F]{1,4}:){6}:))-((([da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(::([da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:):([da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){2}:([da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){3}:([da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?))|(([da-fA-F]{1,4}:){7}[da-fA-F]{1,4})|(:((:[da-fA-F]{1,4}){1,6}|:))|([da-fA-F]{1,4}:((:[da-fA-F]{1,4}){1,5}|:))|(([da-fA-F]{1,4}:){2}((:[da-fA-F]{1,4}){1,4}|:))|(([da-fA-F]{1,4}:){3}((:[da-fA-F]{1,4}){1,3}|:))|(([da-fA-F]{1,4}:){4}((:[da-fA-F]{1,4}){1,2}|:))|(([da-fA-F]{1,4}:){5}:([da-fA-F]{1,4})?)|(([da-fA-F]{1,4}:){6}:)))|(((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/(d|[1-2]d|3[0-2]))?)|((([da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(::([da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:):([da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){2}:([da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){3}:([da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]d|[01]?dd?).){3}(25[0-5]|2[0-4]d|[01]?dd?)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){7}[da-fA-F]{1,4}(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(:((:[da-fA-F]{1,4}){1,6}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|([da-fA-F]{1,4}:((:[da-fA-F]{1,4}){1,5}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){2}((:[da-fA-F]{1,4}){1,4}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){3}((:[da-fA-F]{1,4}){1,3}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){4}((:[da-fA-F]{1,4}){1,2}|:)(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){5}:([da-fA-F]{1,4})?(/([1-9]?d|(1([0-1]d|2[0-8]))))?)|(([da-fA-F]{1,4}:){6}:(/([1-9]?d|(1([0-1]d|2[0-8]))))?)))$
    

      用了以上正则表达式,就可匹配下面的 IP 组合

    1.1.1.1
    1.1.1.2-1.1.1.3
    1.1.2.0/24
    ::1
    ::2-1::
    2::/64
    

      

  • 相关阅读:
    一个、说到所有的扩展指标
    时序图、流程图
    流程图总结
    UML活动图与流程图的区别
    类图与对象图
    app的描述-软件的描述
    UML的目标
    软件建模的用途
    Android中如何使用Intent在Activity之间传递对象[使用Serializable或者Parcelable]
    Serializable 和 Parcelable 区别
  • 原文地址:https://www.cnblogs.com/sunliyuan/p/14378518.html
Copyright © 2020-2023  润新知