Maybe I need some good literature on that to find out where and when such a
thing could happen.
Well, you have perhaps the best case : what you must see is that the
regexp engine want really, really match, and for this it will try all
combinations possibles.
In some case (regexp with combination of more than one quantifier) it will
take exponential time to try all possibilities and you just need to be
patient