0

I am trying to remove the invalid characters in the given email address. I have tried using the below expression to remove the invalid character

select regexp_replace('test|_#test-123@test.com','[[:cntrl:]"#|$%]')
from dual

Expected result : test_test-123@test.com

the above is working but still I need some help to validate the regexp values. Or do we have any other method to remove the invalid characters using oracle query.

Many Thanks Anna

Patrick Bacon
  • 4,490
  • 1
  • 26
  • 33
Anna.P
  • 903
  • 1
  • 6
  • 17
  • Why do you want to replace illegal characters? Why not just detect illegal characters (`REGEXP_LIKE`)? – user2672165 Jul 02 '14 at 09:29
  • The data is coming from the other system, so while processing the data i need to remove the invalid character and process the same. – Anna.P Jul 02 '14 at 09:51
  • This question really examines the use of reg expressions for the purposes of cleaning up email addresses (php in lieu of sql/plsql), http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address?rq=1 – Patrick Bacon Jul 02 '14 at 13:25
  • 4
    I respectfully submit that the source system should be doing the validating and cleansing of the data. How are these invalid characters being allowed in in the first place? Could be a symptom of bigger data quality issues. Once cleaned, how do you know it is a valid address? – Gary_W Jul 02 '14 at 13:28

0 Answers0