Not much to add other than I agree, it is very possible that the regex is the culprit. I've seen the same server error message that has been rectified by fixing up regex.
I don't pretend to understand how it all works, but perhaps the regex is being farmed out to another service somewhere, and the Apps Script engine isn't managing the return of certain errors?
Anyway, feel free to post your regex usage in case someone can spot an issue.
Cheers
Adam