I'm trying to trim email addresses after the @ and before the . So for example if your email is joesmith@domo.com. I just want to return "domo." I'm using the formula tile in Magic ETL.
Using the Replace Text tile, do the following:
The 2nd one is a bit hard to read in the screenshot, it is: \ . . *Be sure to check "use regex" for both as shown below:
Using a formula tile you can use a regexp_replace function to extract just the domain:
REGEXP_REPLACE(`email`, '^[^@]+@([^\.]+)\..*$', '$1')
^ - match the beginning of the string
[^@]+ - Match 1 or more (+) of characters that are NOT (^) the @ symbol.
@ - match the literal @ symbol
[^\.]+
() - Store this for later reference in a match variable. Since this is the first instance it's stored in $1
[^\.]+ - Match 1 or more (+) of characters that are NOT (^) the . symbol. \ is to escape the . character as it has special meaning in regular expressions of any character.
\. - match the literal . character
.* - match 0 or more (*) of any character (.)
$ - match the end of the string
$1 - Where the value between the parenthesis are stored.