Repository: Textualize/rich

Issue:
[REQUEST]Please consider adding MAC/OUI highlighting - similar to IP Address/URL highlighting 
**Add MAC-address oui highlighting**

It'd be a useful addition if Rich could consistently handle highlighting of the multiple mac-address/oui formats that exist

e.g.
000c.298c.500f
0:c:29:8c:50:f
00:0C:29:8C:50:0F
00-0C-29-8C-50-0F
00:0c:29:8c:50:0f



Discussion:
It’s possible. Do you know of a regex for mac addresses?
https://regex101.com/library/yS8eO4 perhaps?

Actually that's not a great example it fails on  0:17:88:70:53:70 for example - I'll keep looking.
What default style would be fitting for this?
Should we match the existing style for IP addresses?
https://github.com/willmcgugan/rich/blob/ebb4eaa26f6c557daf4d03540f21ea277a02824e/rich/default_styles.py#L62-L63
Or perhaps the same as a UUID?
https://github.com/willmcgugan/rich/blob/ebb4eaa26f6c557daf4d03540f21ea277a02824e/rich/default_styles.py#L76
I think it's closer to a IP address, conceptually. Makes sense to use the same style. 
Cool, I'll start working on a patch for this :+1:
I'll add highlighting for IEEE EUI-48 and EUI-64 (mac addresses) accepting three formats:

* Six (EUI-48) or eight (EUI-64) groups of two hex digits with hyphen separators: `01-23-45-67-89-AB` or `01-23-45-FF-FE-67-89-AB`
* Six (EUI-48) or eight (EUI-64) groups of two hex digits with colon separators: `01:23:45:67:89:AB` or `01:23:45:FF:FE:67:89:AB`
* Three (EUI-48) or four (EUI-64) groups of four hex digits with dot separators `0123.4567.89AB` or `0123.45FF.FE67.89AB`

The first two forms are seemingly the most common, and are recommended in this IEEE document: 
https://standards.ieee.org/content/dam/ieee-standards/standards/web/documents/tutorials/eui.pdf
I've found the third form scattered around places, although don't have an "authoritative" reference.

Im thinking of accepting case-insensitive hex digits (e.g. `aa`. `aA`, and `AA`), but not accepting unpadded hex groups (e.g. `00:01` but not `0:1`) .

Let me know if this sounds like the right approach :)
OSX does this annoying thing where it drops leading zeroes (unless it's a double leading zero) - one to be aware of?

- OSX
```
0:18:dd:21:8:6d
```

- linux (as an example of non-annoying behaviour)
```
00:18:dd:21:08:6d
```
Okay, that's easy enough to accommodate (for the hyphen or colon separated notation) 👍

Resolving patch:
diff --git a/rich/default_styles.py b/rich/default_styles.py
--- a/rich/default_styles.py
+++ b/rich/default_styles.py
@@ -61,6 +61,8 @@
     "repr.comma": Style(bold=True),
     "repr.ipv4": Style(bold=True, color="bright_green"),
     "repr.ipv6": Style(bold=True, color="bright_green"),
+    "repr.eui48": Style(bold=True, color="bright_green"),
+    "repr.eui64": Style(bold=True, color="bright_green"),
     "repr.tag_start": Style(bold=True),
     "repr.tag_name": Style(color="bright_magenta", bold=True),
     "repr.tag_contents": Style(color="default"),
diff --git a/rich/highlighter.py b/rich/highlighter.py
--- a/rich/highlighter.py
+++ b/rich/highlighter.py
@@ -80,6 +80,12 @@ class ReprHighlighter(RegexHighlighter):
         r"(?P<path>\B(\/[\w\.\-\_\+]+)*\/)(?P<filename>[\w\.\-\_\+]*)?",
         r"(?P<ipv4>[0-9]{1,3}\.[0-9]{1,3}\.[0-gt9]{1,3}\.[0-9]{1,3})",
         r"(?P<ipv6>([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4})",
+        r"(?P<eui48>([0-9A-Fa-f]{1,2}-){5}[0-9A-Fa-f]{1,2})",  # EUI-48 6x2 hyphen
+        r"(?P<eui64>([0-9A-Fa-f]{1,2}-){7}[0-9A-Fa-f]{1,2})",  # EUI-64 8x2 hyphen
+        r"(?P<eui48>([0-9A-Fa-f]{1,2}:){5}[0-9A-Fa-f]{1,2})",  # EUI-48 6x2 colon
+        r"(?P<eui64>([0-9A-Fa-f]{1,2}:){7}[0-9A-Fa-f]{1,2})",  # EUI-64 8x2 colon
+        r"(?P<eui48>([0-9A-Fa-f]{4}\.){2}[0-9A-Fa-f]{4})",  # EUI-48 3x4 dot
+        r"(?P<eui64>([0-9A-Fa-f]{4}\.){3}[0-9A-Fa-f]{4})",  # EUI-64 4x4 dot
         r"(?<!\\)(?P<str>b?\'\'\'.*?(?<!\\)\'\'\'|b?\'.*?(?<!\\)\'|b?\"\"\".*?(?<!\\)\"\"\"|b?\".*?(?<!\\)\")",
         r"(?P<url>https?:\/\/[0-9a-zA-Z\$\-\_\+\!`\(\)\,\.\?\/\;\:\&\=\%\#]*)",
         r"(?P<uuid>[a-fA-F0-9]{8}\-[a-fA-F0-9]{4}\-[a-fA-F0-9]{4}\-[a-fA-F0-9]{4}\-[a-fA-F0-9]{12})",


Test patch:
diff --git a/tests/test_highlighter.py b/tests/test_highlighter.py
--- a/tests/test_highlighter.py
+++ b/tests/test_highlighter.py
@@ -1,8 +1,34 @@
+"""Tests for the higlighter classes."""
 import pytest
-from rich.highlighter import NullHighlighter
+
+from rich.highlighter import NullHighlighter, ReprHighlighter
+from rich.text import Span, Text
 
 
 def test_wrong_type():
     highlighter = NullHighlighter()
     with pytest.raises(TypeError):
         highlighter([])
+
+
+@pytest.mark.parametrize(
+    "style_name, test_str",
+    [
+        ("repr.eui48", "01-23-45-67-89-AB"),  # 6x2 hyphen
+        ("repr.eui64", "01-23-45-FF-FE-67-89-AB"),  # 8x2 hyphen
+        ("repr.eui48", "01:23:45:67:89:AB"),  # 6x2 colon
+        ("repr.eui64", "01:23:45:FF:FE:67:89:AB"),  # 8x2 colon
+        ("repr.eui48", "0123.4567.89AB"),  # 3x4 dot
+        ("repr.eui64", "0123.45FF.FE67.89AB"),  # 4x4 dot
+        ("repr.eui48", "ed-ed-ed-ed-ed-ed"),  # lowercase
+        ("repr.eui48", "ED-ED-ED-ED-ED-ED"),  # uppercase
+        ("repr.eui48", "Ed-Ed-Ed-Ed-Ed-Ed"),  # mixed case
+        ("repr.eui48", "0-00-1-01-2-02"),  # dropped zero
+    ],
+)
+def test_highlight_regex(style_name: str, test_str: str):
+    """Tests for the regular expressions used in ReprHighlighter."""
+    text = Text(test_str)
+    highlighter = ReprHighlighter()
+    highlighter.highlight(text)
+    assert text._spans[-1] == Span(0, len(test_str), style_name)