I am trying to get a specific part of a text with Oracle regular expression. If there is no end of line character (chr(10)) in the text, I get what I want. But if there is an end of line character, it returns null. You can see the sample sql codes below.
SELECT RegExp_SubStr('TEXT_BEGIN Line 1 Line 2 TEXT_END', 'TEXT_BEGIN(.+)TEXT_END', 1, 1, NULL, 1) FROM dual;returns
Line 1 Line 2
with end of line char.
SELECT RegExp_SubStr('TEXT_BEGIN Line 1' || chr(10) || 'Line 2 TEXT_END', 'TEXT_BEGIN(.+)TEXT_END', 1, 1, NULL, 1) FROM dual;returns
NULL
It may be a solution to convert the end of line characters in the text to a special character such as ## CHR10 ## before SubStr and then back after SubStr. But I want a simple solution without hack.