Select all characters before "@"

Hi everyone,

Does anyone know a way to filter or select only those characters that are before an “@” symbol?

Im trying to extract the characters before the “@” of an email:

i.e. john@gmail.com The result I want is: “John”

Thanks!

Solved Solved
0 6 241
1 ACCEPTED SOLUTION

Steve
Platinum 4
Platinum 4

Try:

ANY(SPLIT("john@gmail.com", "@"))

View solution in original post

6 REPLIES 6

Steve
Platinum 4
Platinum 4

Try:

ANY(SPLIT("john@gmail.com", "@"))

Fantastic simple and beautiful expression!, use any coupled with split.

Thank you once more @Steve !

For those who may see this post later and wonder why this works?

Split expression will return the “list type”. So returns text before after @ in this use case.

List has index, so before @ value is going to get index 1, and texts after @ get index 2.

Any expression is believed to get the randam index number occassionally, but it is not correct, always get the value of list index 1.

So in this simple expression steve came up with is always return the email value removing after @ mark.

This simple (and beautiful) expression could be used to get value removing domain in general.

Thank you Steve.

If i m wrong, please correct me.

Nice analysis @tsuji_koichi.

@Steve indeed brilliantly used ANY() function, thereby eliminating need to use INDEX() after split. Use of INDEX() would have made the overall expression longer in length. Excellent example of creating a compact expression.

@Aleksi and @Steve always create excellent compact expressions.

Yes, using INDEX() would be 4 chars longer

Top Labels in this Space