Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Regex matches string, i do not know why?!

by choroba (Canon)
on Apr 26, 2013 at 12:41 UTC ( #1030819=note: print w/ replies, xml ) Need Help??


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".

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


Comment on Re: Regex matches string, i do not know why?!
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1030819]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (13)
As of 2015-07-07 19:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls