use strict; while () { print "$_" if s/(?:\b\d{1,3}\.){3}\d{1,3}\b/xxx.xxx.xxx.xxx/g; }