I am bit new to DTM , I am working on tracking external links .
I have 2 websites with below domain , same DTM code runs for both .
Suppose i have a external link www.google.com
If i add in Never track section , below URL
will it cover both the domains and will this solution will be enough,
any other link apart from below mentioned will be treated as external link,
or need to write custom code in some manner .
You likely could as almost anything is possible with custom code. If you wanted to go that route, you'd need to suppress page load beacons by having your function return false in the Analytics tool. You'd also need to write a custom condition for event-based rules. I'd recommend writing a script inside a data element and reusing that data element as a condition in each of your event based rules. Keep in mind, this is going to create a bit of overhead as each rule that may fire on those domains will need to have the data element as a condition.
can i custom code for above requirement or not
I was able to test this on a locally hosted site today and it doesn't look like the "Never Track" field supports regex. You'd need to add each domain you wish to ignore separately.
If you have the same web property deployed over both of those domains, you may want to edit your property and utilize the "This site spans multiple domains" setting. You can learn more in our documentation here.