Convert webpage any textual instance that matches regex, to a hyperlink

I want to make a plugin that parses every HTML page, looking for text that matches RegEx ID(?:\.\d{4}){4}.

So that this, for example:
<p>Hello, the ID of your thing is ID.1234.1234.1234 thank you come again</p>

Gets converted to this:
<p>Hello, the ID of your thing is <a href="https://domain.com/ID.1234.1234.1234">ID.1234.1234.1234</a> thank you come again</p>

To match your example, perhaps:

ID(?:\.\d{4}){3}

I’m not an expert on RegEx but I use some code that can match a regex in a text node and surround it with tags for formatting purposes. I suspect you could re-purpose that to create a link.

Check out the function THmo_doHighlight() in this userscript:

https://greasyfork.org/en/scripts/13007-text-highlight-and-seek

(Adapted from https://userscripts-mirror.org/scripts/show/292083 )

You could create a userscript as a proof of concept, and migrate the working code to a content script in an extension.