in reply to Code in regexp

Let's go beyond the nine dots. If we can match your input with a pattern, why cannot we match a pattern with your input? The following code does this, and the regexp is much more simple and easier to understand:
$pattern = "123456789"; $str_under_testing = "345678"; print "okay" if ($pattern =~ /^\d*?$str_under_testing\d*$/);