This article show that there is some regexp that is O(2^n) when backtracking.
The example is (x+x+)+y
.
When attempt to match a string like xxxx...p it going to
Any regex without backreferences can be matched in linear time, though many regex engines out there in the real world don't do it that way (at least many regex engines that are plugged into programming language runtime environments support backreferences, and don't switch to a more efficient execution model when no backreferences are present).
There's no easy way to find out how much time a regex with backreferences is going to consume.