Need to remove whitespace and Chr (10) start and end of string

Hi all
I have a requirement where I need to remove all the spaces and characters to carriage return JUST to THE beginning and the end of the string to preserve those within the chain
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 expected_string on top of the query column.
If I try with ltrim, rtrim, functions I need to write several combinations for first trimming Chr (10) and then spaces or first delete the spaces and then Chr (10) etc.

Is it possible to do this using regular expressions? Help, please.
Thanks in advance!

If I try with ltrim, rtrim, functions I need to write several combinations for first trimming Chr (10) and then spaces or first delete the spaces and then Chr (10) etc.

As Solomon, the two [url http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions096.htm#SQLRF00664] has already shown you LTRIM and RTRIM [url http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions160.htm#SQLRF06104] delete a character set of the designated part of the string.
What many combinations did you have in mind?

Concerning

Etbin

Tags: Database

Similar Questions

Maybe you are looking for