I have a regexp (,\s*?\n)(\s*?)) and according to https://regex101.com/ it should work. The only problem is that it isn't. What I want to achieve is:
'some text,
)'
will get converted to
'some text
)'
I know that if that regexp of mine would somehow work than the output string would be:
'some text)'
Is there any way to not move the ')' to the same line as 'some text'?
The sample that I used for testing:
declare
l_example varchar2(32000);
begin
l_example :='some text,
)';
dbms_output.put_line(l_example);
l_example := regexp_replace(l_example, '(,\s*?\n)(\s*?\))', '\2');
dbms_output.new_line;
dbms_output.put_line(l_example);
END;
/
Please check this:
regexp_replace(l_example, '(,\s*?'|| CHR(10)||' *)(\s*?\))', '\2', 1, 1,'m');