Demo entry 5865307

test.ex

   

Submitted by anonymous on Aug 15, 2016 at 22:05
Language: Elixir. Code size: 276 Bytes.

  def get_user_tags(msg) when is_binary(msg) do
    regex = ~r/@(?:"([^"]*)|([^\s]*))/
    # regex = ~r/@("(?<m>[^"]*)|(?<n>[^\s]*))/
    for r <- Regex.scan(regex, msg, capture: :all_but_first),
      res = List.last(r),
      String.length(res)>0,
      do: res
  end

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).