>>105878439Backtracking regex engine are good when you are really parsing something, for example a URL, where you would extract the protocol, domain, path, framgent, etc... For this kind of "parsing" purpose, the grammar of the thing you're trying to match is usually LL(1) or LL(k) with a small k.
I claim that a backtracking regex engine where the regex (program) is matching a LL(1)/LL(k) grammar will run in linear time when matching a valid input string. I can't give you a proof but it's not hard to see if you follow the control flow of the matching of a regex like that.
Now, if the input string is not a valid string from the grammar and there is basically a syntax error in the middle, the runtime can be anywhere from linear to exponential depending on how much there is backtracking in the regex. If you removes the unecessary backtracking, the regex engine with linearly backtrack (similarly to how a recursive descent parser would) until the root of regex and fail. But if you didn't, yeah, it can backtrack to hell depending on the input string and on the regex. To me the important thing is that it's possible to write regexes in such a way that you make the runtime linear.
That's the very important part for using a backtring regex engine efficiently: it's not because backtracking regex egines can backtrack to hell (exponentially) that your regex should allow this to happen. Perl/pcre backtracking regex engines allows you to remove unecessary backtracking (with independent patterns (?> ..), quantifier modifiers and backtracknig control verbs) and for the kind of LL(k) parsing tasks ***you don't need*** lots of backtracking, you almost don't need any backtracking in fact.