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!

Try:

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

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

1 Like

Thank you once more @Steve !

1 Like

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. :+1: :clap:

If i m wrong, please correct me. :grinning:

4 Likes

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.

1 Like

Yes, using INDEX() would be 4 chars longer :smiley: :smiley:

2 Likes