Search code examples
sqlregexapache-superset

Superset: Remove leading @usernames from string?


In Superset's SQL Editor, I have a column with string values of which some start with one or more usernames followed by a blank space, followed by the actual text.

@usern1 @user2 then some text

How can I remove them? so I tried this which did not work:

REGEXP_REPLACE(text, '(@[a-zA-Z0-9_]+\\s)+', '')

Thx!


Solution

  • You can use the following pattern to match the leading text.

    ^(?:@[^ ]+ )+