pysome has asked for the wisdom of the Perl Monks concerning the following question:
Hi monks,
I only wanna to match a string that could not contain a sub-string.Such as
Thanks
Pysome
#!/usr/bin/perl $s = "a000000000b"; if ($s =~ /^a.*(?!ab).*b$/) { print "yes"; } else { print "no"; }
My ideal result is to match string that : 1)start with "a" 2)end with "b" 3)don't include "ab" between them. That is to say, "a000000000b" : matched "a0a0000b00b" : matched but "a0000ab000b" : unmatchedI use negative look-ahead assertion (?!ab) ,but it can't work.Can somebody help me?
Thanks
Pysome
Back to
Seekers of Perl Wisdom