/^([A-Za-z]([A-Za-z]|[0-9]|[+\-.])*:(\/\/((([A-Za-z]|[0-9]|[-._~])|%[0-9A-Fa-f][0-9A-Fa-f]|[!$&'()*+,;=]|:)*@)?(\[(((([0-9A-Fa-f]){1,4}:){6}((([0-9A-Fa-f]){1,4}:([0-9A-Fa-f]){1,4})|([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35]))|::(([0-9A-Fa-f]){1,4}:){5}((([0-9A-Fa-f]){1,4}:([0-9A-Fa-f]){1,4})|([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35]))|(([0-9A-Fa-f]){1,4})?::(([0-9A-Fa-f]){1,4}:){4}((([0-9A-Fa-f]){1,4}:([0-9A-Fa-f]){1,4})|([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35]))|((([0-9A-Fa-f]){1,4}:){0,1}([0-9A-Fa-f]){1,4})?::(([0-9A-Fa-f]){1,4}:){3}((([0-9A-Fa-f]){1,4}:([0-9A-Fa-f]){1,4})|([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35]))|((([0-9A-Fa-f]){1,4}:){0,2}([0-9A-Fa-f]){1,4})?::(([0-9A-Fa-f]){1,4}:){2}((([0-9A-Fa-f]){1,4}:([0-9A-Fa-f]){1,4})|([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35]))|((([0-9A-Fa-f]){1,4}:){0,3}([0-9A-Fa-f]){1,4})?::([0-9A-Fa-f]){1,4}:((([0-9A-Fa-f]){1,4}:([0-9A-Fa-f]){1,4})|([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35]))|((([0-9A-Fa-f]){1,4}:){0,4}([0-9A-Fa-f]){1,4})?::((([0-9A-Fa-f]){1,4}:([0-9A-Fa-f]){1,4})|([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35]))|((([0-9A-Fa-f]){1,4}:){0,5}([0-9A-Fa-f]){1,4})?::([0-9A-Fa-f]){1,4}|((([0-9A-Fa-f]){1,4}:){0,6}([0-9A-Fa-f]){1,4})?::)|v+\.(([A-Za-z]|[0-9]|[-._~])|[!$&'()*+,;=]|:)+)\]|([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])|(([A-Za-z]|[0-9]|[-._~])|%[0-9A-Fa-f][0-9A-Fa-f]|[!$&'()*+,;=])*)(:([0-9])*)?(\/((([A-Za-z]|[0-9]|[-._~])|%[0-9A-Fa-f][0-9A-Fa-f]|[!$&'()*+,;=]|[:@]))*)*|\/(((([A-Za-z]|[0-9]|[-._~])|%[0-9A-Fa-f][0-9A-Fa-f]|[!$&'()*+,;=]|[:@]))+(\/((([A-Za-z]|[0-9]|[-._~])|%[0-9A-Fa-f][0-9A-Fa-f]|[!$&'()*+,;=]|[:@]))*)*)?|((([A-Za-z]|[0-9]|[-._~])|%[0-9A-Fa-f][0-9A-Fa-f]|[!$&'()*+,;=]|[:@]))+(\/((([A-Za-z]|[0-9]|[-._~])|%[0-9A-Fa-f][0-9A-Fa-f]|[!$&'()*+,;=]|[:@]))*)*|)(\?((([A-Za-z]|[0-9]|[-._~])|%[0-9A-Fa-f][0-9A-Fa-f]|[!$&'()*+,;=]|[:@])|[\/?])*)?(#((([A-Za-z]|[0-9]|[-._~])|%[0-9A-Fa-f][0-9A-Fa-f]|[!$&'()*+,;=]|[:@])|[\/?])*)?|(\/\/((([A-Za-z]|[0-9]|[-._~])|%[0-9A-Fa-f][0-9A-Fa-f]|[!$&'()*+,;=]|:)*@)?(\[(((([0-9A-Fa-f]){1,4}:){6}((([0-9A-Fa-f]){1,4}:([0-9A-Fa-f]){1,4})|([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35]))|::(([0-9A-Fa-f]){1,4}:){5}((([0-9A-Fa-f]){1,4}:([0-9A-Fa-f]){1,4})|([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35]))|(([0-9A-Fa-f]){1,4})?::(([0-9A-Fa-f]){1,4}:){4}((([0-9A-Fa-f]){1,4}:([0-9A-Fa-f]){1,4})|([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35]))|((([0-9A-Fa-f]){1,4}:){0,1}([0-9A-Fa-f]){1,4})?::(([0-9A-Fa-f]){1,4}:){3}((([0-9A-Fa-f]){1,4}:([0-9A-Fa-f]){1,4})|([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35]))|((([0-9A-Fa-f]){1,4}:){0,2}([0-9A-Fa-f]){1,4})?::(([0-9A-Fa-f]){1,4}:){2}((([0-9A-Fa-f]){1,4}:([0-9A-Fa-f]){1,4})|([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35]))|((([0-9A-Fa-f]){1,4}:){0,3}([0-9A-Fa-f]){1,4})?::([0-9A-Fa-f]){1,4}:((([0-9A-Fa-f]){1,4}:([0-9A-Fa-f]){1,4})|([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35]))|((([0-9A-Fa-f]){1,4}:){0,4}([0-9A-Fa-f]){1,4})?::((([0-9A-Fa-f]){1,4}:([0-9A-Fa-f]){1,4})|([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35]))|((([0-9A-Fa-f]){1,4}:){0,5}([0-9A-Fa-f]){1,4})?::([0-9A-Fa-f]){1,4}|((([0-9A-Fa-f]){1,4}:){0,6}([0-9A-Fa-f]){1,4})?::)|v+\.(([A-Za-z]|[0-9]|[-._~])|[!$&'()*+,;=]|:)+)\]|([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])\.([0-9]|[\x31-\x39][0-9]|1([0-9]){2}|2[\x30-\x34][0-9]|25[\x30-\x35])|(([A-Za-z]|[0-9]|[-._~])|%[0-9A-Fa-f][0-9A-Fa-f]|[!$&'()*+,;=])*)(:([0-9])*)?(\/((([A-Za-z]|[0-9]|[-._~])|%[0-9A-Fa-f][0-9A-Fa-f]|[!$&'()*+,;=]|[:@]))*)*|\/(((([A-Za-z]|[0-9]|[-._~])|%[0-9A-Fa-f][0-9A-Fa-f]|[!$&'()*+,;=]|[:@]))+(\/((([A-Za-z]|[0-9]|[-._~])|%[0-9A-Fa-f][0-9A-Fa-f]|[!$&'()*+,;=]|[:@]))*)*)?|(([A-Za-z]|[0-9]|[-._~])|%[0-9A-Fa-f][0-9A-Fa-f]|[!$&'()*+,;=]|@)+(\/((([A-Za-z]|[0-9]|[-._~])|%[0-9A-Fa-f][0-9A-Fa-f]|[!$&'()*+,;=]|[:@]))*)*|)(\?((([A-Za-z]|[0-9]|[-._~])|%[0-9A-Fa-f][0-9A-Fa-f]|[!$&'()*+,;=]|[:@])|[\/?])*)?(#((([A-Za-z]|[0-9]|[-._~])|%[0-9A-Fa-f][0-9A-Fa-f]|[!$&'()*+,;=]|[:@])|[\/?])*)?)$/
Source rules