How to check that a regular expression fall into infty loop or not?

Posted by Sorush Rabiee on Stack Overflow See other posts from Stack Overflow or by Sorush Rabiee
Published on 2011-01-01T21:43:47Z Indexed on 2011/01/01 21:53 UTC
Read the original article Hit count: 239

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about regex

Related posts about qt