Skip to content

Commit 9456e93

Browse files
committedMar 27, 2025·
Update Regex docs to Erlang/OTP 28
1 parent e7b235f commit 9456e93

File tree

1 file changed

+4
-32
lines changed

1 file changed

+4
-32
lines changed
 

‎lib/elixir/lib/regex.ex

+4-32
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,11 @@ defmodule Regex do
1919
# A regular expression with case insensitive and Unicode options
2020
~r/foo/iu
2121
22-
Regular expressions created via sigils are pre-compiled and stored
23-
in the `.beam` file. Note that this may be a problem if you are precompiling
24-
Elixir, see the "Precompilation" section for more information.
25-
2622
A Regex is represented internally as the `Regex` struct. Therefore,
2723
`%Regex{}` can be used whenever there is a need to match on them.
28-
Keep in mind that all of the structs fields are private. There is
29-
also no guarantee two regular expressions from the same source are
30-
equal, for example:
24+
Keep in mind that all of the structs fields are private. And since
25+
regexes are compiled, there is no guarantee two regular expressions
26+
from the same source are equal, for example:
3127
3228
~r/(?<foo>.)(?<bar>.)/ == ~r/(?<foo>.)(?<bar>.)/
3329
@@ -96,15 +92,6 @@ defmodule Regex do
9692
* `:ungreedy` (U) - inverts the "greediness" of the regexp
9793
(the previous `r` option is deprecated in favor of `U`)
9894
99-
The options not available are:
100-
101-
* `:anchored` - not available, use `^` or `\A` instead
102-
* `:dollar_endonly` - not available, use `\z` instead
103-
* `:no_auto_capture` - not available, use `?:` instead
104-
* `:newline` - not available, use `(*CR)` or `(*LF)` or `(*CRLF)` or
105-
`(*ANYCRLF)` or `(*ANY)` at the beginning of the regexp according to the
106-
`:re` documentation
107-
10895
## Captures
10996
11097
Many functions in this module handle what to capture in a regex
@@ -171,26 +158,11 @@ defmodule Regex do
171158
iex> Regex.replace(~r/\s/u, "Unicode\u00A0spaces", "-")
172159
"Unicode-spaces"
173160
174-
## Precompilation
175-
176-
Regular expressions built with sigil are precompiled and stored in `.beam`
177-
files. Precompiled regexes will be checked in runtime and may work slower
178-
between operating systems and OTP releases. This is rarely a problem, as most Elixir code
179-
shared during development is compiled on the target (such as dependencies,
180-
archives, and escripts) and, when running in production, the code must either
181-
be compiled on the target (via `mix compile` or similar) or released on the
182-
host (via `mix releases` or similar) with a matching OTP, operating system
183-
and architecture as the target.
184-
185-
If you know you are running on a different system than the current one and
186-
you are doing multiple matches with the regex, you can manually invoke
187-
`Regex.recompile/1` or `Regex.recompile!/1` to perform a runtime version
188-
check and recompile the regex if necessary.
189161
"""
190162

191163
defstruct re_pattern: nil, source: "", opts: []
192164

193-
@type t :: %__MODULE__{re_pattern: term, source: binary, opts: binary | [term]}
165+
@type t :: %__MODULE__{re_pattern: term, source: binary, opts: [term]}
194166

195167
defmodule CompileError do
196168
@moduledoc """

0 commit comments

Comments
 (0)
Please sign in to comment.