If you are looking for the string ORA-04031 and ONLY that string, then tell the regex engine that:
0 isn't a special character in Perl regex's, and the () is for capturing some match.
If this isn't what you're trying to do, please explain your problem in more detail.