Help converting regex (to remove emojis)

I’m a fan of no-break-space since its really useful for number formatting :slight_smile:

1 Like

I’m having the same problem, can you tell me how your function turned out?

I just did this:

Regex.replace(~r/\p{So}/u, v, “”)

2 Likes

Here’s what I ended up doing in my changeset to remove emojis from my schema’s name field:

def changeset(my_schema, attrs) do
  attrs = Map.update(attrs, :name, "", &String.replace(&1, ~r/\p{So}/u, ""))

  my_schema
  |> cast(attrs, [
    :name,
    # snip
1 Like