Skip to content

Instantly share code, notes, and snippets.

@alco
Created September 4, 2013 09:23
Show Gist options
  • Save alco/6434713 to your computer and use it in GitHub Desktop.
Save alco/6434713 to your computer and use it in GitHub Desktop.
iex(8)> Regex.run %r/^~(\d)+\.\.[0 ]B$/, "~4..0B"
["~4..0B", "4"]
iex(9)> Regex.run %r/^~(\d)+\.\.[0 ]B$/, "~4..0B", capture: :groups
** (ArgumentError) regex was not compiled with g
/Users/alco/Documents/git/elixir/lib/elixir/lib/regex.ex:134: Regex.run/3
erl_eval.erl:569: :erl_eval.do_apply/6
src/elixir.erl:138: :elixir.eval_forms/3
iex(9)> Regex.run %r/^~(\d)+\.\.[0 ]B$/g, "~4..0B", capture: :groups
[]
iex(10)> Regex.scan %r/^~(\d)+\.\.[0 ]B$/, "~4..0B"
[["~4..0B", "4"]]
iex(11)> Regex.scan %r/^~(\d)+\.\.[0 ]B$/, "~4..0B", capture: :groups
** (ArgumentError) regex was not compiled with g
/Users/alco/Documents/git/elixir/lib/elixir/lib/regex.ex:240: Regex.scan/3
erl_eval.erl:569: :erl_eval.do_apply/6
src/elixir.erl:138: :elixir.eval_forms/3
iex(11)> Regex.scan %r/^~(\d)+\.\.[0 ]B$/g, "~4..0B", capture: :groups
** (CaseClauseError) no case clause matching: :match
/Users/alco/Documents/git/elixir/lib/elixir/lib/regex.ex:245: Regex.scan/3
erl_eval.erl:569: :erl_eval.do_apply/6
src/elixir.erl:138: :elixir.eval_forms/3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment