Am 25.12.2014 um 16:02 schrieb Paul "LeoNerd" Evans: > Given a string, $str, and a regexp, $re, I know that the regexp does > not currently match: > > ok( not $str =~ $re ); > > However, currently Perl has no way to let me distinguish the two very > importantly different cases of: > > 1) $str contains characters that cause $re not to match > 2) $str does not contain enough characters to cause $re to match There's also 3) $str matches $re but adding more characters may make it fail 4) $str matches $re but adding more characters may match more Example: 3) $str = "foo"; $re = qr/\bfoo\b/; 4) $str = "foo"; $re = qr/\w+/; I think what I want to know here is whether regexec() reached EOS in any way or not. > ----- > > In summary: > > I'd like a way to know if a regexp fails to match because it ran out > of input but was happy until that point, or if it found some bad > characters that adding more input to will never help. > -- Lukas Mai <plokinom@gmail.com>Thread Previous | Thread Next