Learned something new today about Regex capture groups, which I had not learned before.
In regex a capture group is the block between the parenthesis, which has all sorts of uses for replacement and fun coding tricks.
For example,
# My Regex
.+(hostname:.+)
# Is often referenced as \1
The cool part is we can name the capture group for other purposes as well, so it’s not simply \1 \2
This creates a named group called middles
my-(?<middles>\w+).+
It would match the middle work of the domain, as long as it matches \w
my-stuff-name.com
my-domain-name.com
my-place-name.com
my-example-name.com
Some other engines will do named Regex capture groups with
(?P<name>\w+)
#regex