'Replace letter before space oracle

I have different strings and I need to change a specific character if its at the end of each word For example input string 'atyu auds aseu udae' to be 'aty* auds ase* udae' it will replace letter u only if it was last digit need it in oracle sql



Solution 1:[1]

One option is to use regular expression, such as

SQL> with test (col) as
  2    (select 'atyu auds aseu udaeu' from dual)
  3  select trim(regexp_replace(col, 'u |u$', '* ')) result
  4  from test;

RESULT
--------------------
aty* auds ase* udae*

SQL>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Littlefoot