I am fairly new to regex so apologies if this is not correct in terms of syntax.
I have noticed that (^|\.) seems to require a fair amount more steps than alternative methods. Could it be worth swapping to something along the lines of \bdoubleclick\.net$?
Two examples compared below:
Bonus:
URL: adspaces.ero-apaces.ero-advertising.com
(^|\.)ero-advertising\.com$ > 1 match, 91 steps
\bero-advertising\.com$ > 1 match, 31 steps
I know we may only be talking a few milliseconds here and there, but I am sure it will add up.
It may appear to be more complex because it’s checking for a couple more things, but there’s something about including the caret (^) in a capture group (or, just not at the start of the line) that increases the steps / processing time quite significantly.
Edit: Look at the difference in steps / processing for these two: