there is a lot exception n oracle and there are have different masks are you want to code all of them?
You currenct regexp may be looked like:
select regexp_replace('ORA-01400: cannot insert NULL into ("ABC_OWNER"."ABC_PART"."REGION")'
,'^ORA-\d+:\s(.+)\(.+\.\"(.+)\"\)', '\1 \2') from dual
EDIT: description of regexp '^ORA-\d+:\s(.+)(.+.\"(.+)\")'
- "^" - begin of the string
- "ORA-" - simple string "ORA-"
- "\d+" - series of digits
- ":" - simple colon
- "\s" - white-space
- "(.+)" - the longest string of any characters. And
()
mean that is will be captured as group(\1).
- "(" - left bracket
- ".+" - the longest string of any characters.
- "."- simple dot
- \" - double quote
- (.+) - the longest string of any characters. And next group (\2)
- \" - double quote
- )' - right bracket
Regexp in points 6,8 and 11 will be hungry search it will try to fined the longest string from first group. It mean if there are some variants between length of "6","8" and "11". "6" will chose first and take all that it can "8" will chose next and "11" least.
For instance if you have string aaaaaa
and regexp (.+)(.+)
the first group will take aaaaa
and the second a