%s matches null string many times (W regexp) The pattern you've specified would be an infinite loop if the regular expression engine didn't specifically check for that. See the perlre manpage.