Major update of URL syntax highlighting
authorStefan Huber <shuber@sthu.org>
Wed, 19 Jan 2022 09:58:58 +0000 (10:58 +0100)
committerStefan Huber <shuber@sthu.org>
Wed, 19 Jan 2022 09:58:58 +0000 (10:58 +0100)
colors-gruvbox-shuber.muttrc

index 8dd8d190acdc4ef184429c59f0b6598aaf7ad1ed..a38198a675f81be09661f88cbcd5664c3ca84986 100644 (file)
@@ -62,16 +62,34 @@ color header color142 color234 "^Subject:"
 color header color108 color234 "^X-Spam-Status:"
 color header color108 color234 "^Received:"
 
-# BSD's regex has RE_DUP_MAX set to 255.
-# schema://stuff
-color body color142 color234 "[a-z]{3,255}://[-a-zA-Z0-9@:%._\\+~#=/?&,;]+"
-# fully qualified hostnames
-color body color142 color234 "[a-zA-Z]([-a-zA-Z0-9_]+\\.){2,255}[-a-zA-Z0-9_]{2,255}"
-# mail addresses
+# Regex magic for URLs and hostnames
+#
+# Attention: BSD's regex has RE_DUP_MAX set to 255.
+#
+# Examples:
+#   http://some-service.example.com
+#   example.com
+#   a.example.com
+#   some-service.example.com
+#   example.com/
+#   example.com/datenschutz
+#
+# Non-examples:
+#   1.1.1900
+#   23.59
+#   w.l.o.g
+color body color142 color234 "([a-z]{3,255}://)?[[:alpha:]]\\.?([-[:alnum:]]+\\.)+[-[:alnum:]]{2,10}(/[[:graph:]]*)?"
+color body color142 color234 "file:///[[:graph:]]*"
+
+# IPv4 and IPv6 stolen from https://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses
+color body color142 color234 "((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])"
+color body color142 color234 "(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))"
+
+# Mail addresses and mailto URLs
 color body color208 color234 "[-a-z_0-9.%$]+@[-a-z_0-9.]+\\.[-a-z][-a-z]+"
-# mailto URLS
 color body color208 color234 "mailto:[-a-z_0-9.]+@[-a-z_0-9.]+"
-# some simleys
+
+# some simleys and stuff
 color body color234 color214 "[;:]-*[)>(<lt;|]"
 color body color229 color234 "\\*[- A-Za-z]+\\*"