We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dfa7d58 commit 51cc052Copy full SHA for 51cc052
lib/elixir/lib/kernel.ex
@@ -6657,7 +6657,16 @@ defmodule Kernel do
6657
# TODO: Remove this when we require Erlang/OTP 28.1+
6658
is_binary(binary_or_tuple) and Code.ensure_loaded?(:re) and
6659
function_exported?(:re, :import, 1) ->
6660
- Macro.escape(Regex.compile_export!(binary_or_tuple, bin_opts))
+ %{re_pattern: exported_pattern, source: source, opts: opts} =
6661
+ Regex.compile_export!(binary_or_tuple, bin_opts)
6662
+
6663
+ quote do
6664
+ %Regex{
6665
+ re_pattern: :re.import(unquote(Macro.escape(exported_pattern))),
6666
+ source: unquote(source),
6667
+ opts: unquote(opts)
6668
+ }
6669
+ end
6670
6671
true ->
6672
quote(do: Regex.compile!(unquote(binary_or_tuple), unquote(bin_opts)))
0 commit comments