Actually I think it is NP-Hard. Determining that you have
a match is polynomial. Determining that you have the
match that you are looking for (which is the difference
between .* and .*?) is another story entirely... :-)
Comment on RE (tilly) 2: Regular Expression Optimizer
You may be right... I know that it's been shown that NP-Complete problems can be reduced (in P time) to a Perl regex match. But I don't think the proofs I've seen looked at .* vs. .*?. The constructions used backreferences.