http://www.perlmonks.org?node_id=1018496


in reply to Match domain names except one

should not match with the string (wt)

If you do not want to match wt string directly check for unless /\.wt\./ and print.

use strict; use warnings; use utf8; while(<DATA>) { unless(/\.wt\./) { print "matches : $_\n"; } } __DATA__ https://www.abc.com.wi.pr.com/ https://www.abc.com/ https://www.def.com.wi.pr.com/ https://www.wt.com.wi.pr.com/