select '11dd$%e11!@h' as input, regexp_replace('11dd$%e11!@h', '[^[:alnum:]]') as output
from dual
;
INPUT OUTPUT
------------ --------
11dd$%e11!@h 11dde11h
[:alnum:]
is shorthand for all letters (standard ASCII letters, lower and upper case) and all digits. [^ ... ]
means everything EXCEPT ...
. So, this will replace everything EXCEPT letters and digits with... nothing (since we didn't give a third argument to REGEXP_REPLACE).
EDIT: The OP added a second part to the question.
If the assignment is to remove all the alpha-numeric characters ONLY, and to keep everything else, simply remove the ^
from the regular expression.
select '11dd$%e11!@h' as input, regexp_replace('11dd$%e11!@h', '[[:alnum:]]') as output
from dual
;
INPUT OUTPUT
------------ ------
11dd$%e11!@h $%!@