So I am using Snowflake and specifically the REGEXP_REPLACE function. I am looking for a Regex expression that will match any word with an @ symbol in it in a text field.
Example:
RAW_DATA | CLEANED_DATA |
---|---|
here is a sample and then an [email protected] | here is a sample and then an xxxxx |
[email protected] | xxxxx |
What I have tried so far is:
Select regexp_replace('[email protected]' , '(([a-zA-Z] )(\W)?([a-zA-Z] ))', 'xxxxxxx') as result;
Result:
[email protected]
CodePudding user response:
You can use
Select regexp_replace('here is a sample and then an [email protected]' , '\\S @\\S ', 'xxxxx') as result;
Here,
\S
- one or more non-whitespace chars@
- a@
char\S
- one or more non-whitespace chars