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


in reply to Regex matches string, i do not know why?!

Try adding grouping parentheses to see what is matching:
my $s = 'abc_IoExtFscInjS_GetGlobalDatasetActvMethod'; print "1 $1\n" if $s =~ /((?!Eth.+cfg)Eth)/i; print "2 $1\n" if $s =~ /((?!abc_Eth.+cfg)abc_Eth)/i;

Output:

1 eth

You are using the /i modifier which makes the matching case insensitive. The string indeed contains "eth" which is not preceded by "eth.+cfg".

لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ