Subject: bug#34823: 27.0.50; re-search-forward infloop

From: Mattias Engdegård <[email-masked]>
Date: Fri, 29 Mar 2019 14:28:18 +0100

It is not actually an infinite loop; it just takes a very long time.

Your case is, more or less, essentially

(search-string "\\(?:a*\\)*b" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")

Try trimming the string, and you will see that the match does terminate (and fail); it is just super-linear in the length of the text.
This is a shortcoming of the general type of regexp engine used by Emacs.

To work around your problem, you should make the regexp less prone to backtracking. Try asking on the list [email-masked] for advice. Describe what text you wish to match as precisely as possible.