This is probably because the regexp goes into a loop. Try to find a
simpler regexp that terminates faster in case of an error.
*? or validate the text in pieces by first
matching part of the regexp (the header). If there is no header ->
Then strip the header. Search the rest of the input for the inverse of
the allowed characters (
[^...allowed chars...]. If you have a
match anywhere -> error