# $s does not match, but '12' would be consumed in the # match attempt. In this case, all of $s is consumed # so $s should be able to match if additional characters # were added $s = '12' $r = qr/^123$/; could_match( $r, $s ) # returns TRUE # $s does not match and none of $s would be consumed in the # attempt as the '1' in the regex could not match. Since # $s was not consumed in it's entirety in the match attmempt # there are no characters that could be added to $s to allow # it to match $r $s = '23' $r = qr/^123$/; could_match( $r, $s ) # returns FALSE # $r in this case is not anchored, so it could always match # if more characters were added. However, since none of $s # was used in the match attempt, the entirety of $s could # not match even if more characters were added. $s = '123'; $r = qr/456/; could_match( $r, $s ) # returns FALSE