Catching and swallowing regex pattern exceptions