Lots of Nerd Alerts lately, but I haven’t unloaded the camera to see which family pics turned out to be in focus…
PROBLEM: Your data has zero or more trailing commas followed by a non-printing character, typically LF/CR.
SOLUTION: regexp_replace!
regexp_replace(a.SOME_COL,',*[^[:print:]]$','') as SOME_COL
The regular expression breaks up like so:
',*[^[:print:]]$'
,*
means look for zero or more commas, followed by…[ ]
…the contents of the brackets, which breaks up as^
means not the things in the inner brackets[:print:]
is the class of printable characters$
…leading to the end of the line, which in regexp speech is “$”
It’s not works.
But this is works :
select regexp_replace(chr(10)||’ ‘||chr(9)||chr(13)||’text’||chr(10)||’ ‘||chr(9)||chr(13),’^[[:space:]]+|[[:space:]]+$’,”) as SOME_COL
from dual
Regards.
I don’t have an Oracle box to test the expression above. It looks to me that the expression in comment is solving for a different problem than what I outlined, but if it helps somebody else who comes across this post, all the better.