Hi All,
I have an requirement where I need to remove all white spaces and carriage return characters from JUST THE beginning and end of the string preserving those from within the string
e.g. string is like
SELECT ' This is first Line '||chr(10)||' This is second line. '||chr(10)||' ' Input_String,
REPLACE(' This is first Line '||chr(10)||' This is second line. '||chr(10)||' ',' ','#') spaces_replaced,
REPLACE(REPLACE(' This is first Line '||chr(10)||' This is second line. '||chr(10)||' ',' ','#'),chr(10),'@') carriage_returns_replaced,
'This is first Line '||chr(10)||' This is second line.' Expected_String
FROM DUAL;
The expected output is column expected_string from above query.
If I try with ltrim, rtrim functions I need to write multiple combinations for first trimming chr(10) and then spaces OR first remove spaces and then chr(10) etc.
Is it possible to achieve this using regular expressions? Please help.
Thanks in advance!