How to check that a regular expression fall into infty loop or not?
- by Sorush Rabiee
I'm trying to learn and hopefully use regular expression with Qt.
I found that some patterns cause handler to fall into loop. for example searching \b\b in a text, never will terminate. and number of these expressions is infinite (\b\b\b,\b\b\b\b and so on).
I'd like to determine and control all invalid expressions.
Is there an algorithm to distinguish valid and invalid expressions? If not, how can I prevent my program from falling into an infinite loop?