title: Oracle regexp trailing spaces
body: <p>How do I remove only trailing spaces and chr(10) and chr(13) using Oracle regexp in a sql statement?</p>
  
  <p>Example:</p>
  
  <pre><code>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;
  </code></pre>
  
  <p>Desired result:</p>
  
  <pre><code>'  Hey Bob'
  1. Leading and non-trailing spaces remain
  2. Trailing spaces and eol characters removed
  </code></pre>