my $contents = "

no tabs here

column 1[tab]column 2

no tabs here

"; if ($contents =~ m{(

[^<>]*\[tab\][^<>]*

)} ){ print "Matched '$1'\n;"; }