$str = "doctor_who:eeh1234LMNOP51234.123";
I want to match doctor_who:ee
not doctor_who:eeh
;
$str =~ m/doctor_who:e(?!eh)[epx];
I want to know the role of regular expression within Parentheses;
$str = "doctor_who:eeh1234LMNOP51234.123";
I want to match doctor_who:ee
not doctor_who:eeh
;
$str =~ m/doctor_who:e(?!eh)[epx];
I want to know the role of regular expression within Parentheses;
A component like (?! ... )
will fail to match if the following characters in the target string match the enclosed regex pattern. It's called a negative look-ahead
It's unclear whether you need help to form a pattern to your requirements, or if you've come across a pattern that you don't understand
If I was writing it, I'd look at your specification
I want to match 'doctor_who:ee' not 'doctor_who:eeh'
You want to match doctor_who:ee
that isn't followed by h
, which is
/doctor_who:ee(?!h)/