Home > Net >  How to remove any special characters from a string even with dot and comma and spaces
How to remove any special characters from a string even with dot and comma and spaces

Time:02-22

INPUT STRING:'HI every one. I want to (2-21-2022) remove the comma-dot and other any special character from string(123)'.

OUTPUT STRING:'HI every one I want to 2-21-2022 remove the @comma dot and other any special #character from string 123'

Thanks IN Advance.

CodePudding user response:

If what you said in title:

remove any special characters from a string even with dot and comma and spaces

means that you'd want to keep only digits and letters, then such a regular expression might do:

SQL> with test (col) as
  2    (select 'HI every one. I want to (2-21-2022) remove the comma-dot and other any special character from string(123)' from dual)
  3  select regexp_replace(col, '[^[:alnum:]]') result
  4  from test;

RESULT
---------------------------------------------------------------------------------
HIeveryoneIwantto2212022removethecommadotandotheranyspecialcharacterfromstring123


SQL>

On the other hand, that's not what example you posted represents (as already commented).

  • Related