-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Description
Environment
- Elixir & Erlang/OTP versions (elixir --version):
Erlang/OTP 21 [erts-10.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]
Elixir 1.7.4 (compiled with Erlang/OTP 21)
- Operating system: Arch Linux, kernel 4.19.9.a-1-hardened
Current behavior
iex(1)> Regex.compile!(~r//)
** (FunctionClauseError) no function clause matching in Regex.compile/4
The following arguments were given to Regex.compile/4:
# 1
~r//
# 2
[]
# 3
""
# 4
{"8.42 2018-03-20", :little}
Attempted function clauses (showing 1 out of 1):
defp compile(source, opts, doc_opts, version) when is_binary(source)
(elixir) lib/regex.ex:155: Regex.compile/4An error is also raised when calling the non-bang version.
I expect others who are relatively new to elixir will run into this as well, since it's not immediately obvious that ~r// compiles the regex on its own.
Expected behavior
A Regex.CompileError is raised instead when calling the bang version, or an error tuple is returned from the non-bang version.
AndrewDryga
Metadata
Metadata
Assignees
Labels
No labels