How do I remove only trailing spaces and chr(10) and chr(13) using Oracle regexp in a sql statement?
Example:
with txt as (select chr(10)||chr(10)||' Hey Bob '||chr(10)||chr(13) a from dual)
select a
,regexp_replace(a,chr(10)||'+|'||chr(13)||'+|'||chr(32)||'+$','')
,regexp_replace(a,'['||chr(10)||'+'||chr(13)||'+'||chr(32)||'+]$','')
from txt;
Desired result:
' Hey Bob'
1. Leading and non-trailing spaces remain
2. Trailing spaces and eol characters removed