@@ -19,15 +19,11 @@ defmodule Regex do
19
19
# A regular expression with case insensitive and Unicode options
20
20
~r/foo/iu
21
21
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
-
26
22
A Regex is represented internally as the `Regex` struct. Therefore,
27
23
`%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:
31
27
32
28
~r/(?<foo>.)(?<bar>.)/ == ~r/(?<foo>.)(?<bar>.)/
33
29
@@ -96,15 +92,6 @@ defmodule Regex do
96
92
* `:ungreedy` (U) - inverts the "greediness" of the regexp
97
93
(the previous `r` option is deprecated in favor of `U`)
98
94
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
-
108
95
## Captures
109
96
110
97
Many functions in this module handle what to capture in a regex
@@ -171,26 +158,11 @@ defmodule Regex do
171
158
iex> Regex.replace(~r/\s/u, "Unicode\u00A0spaces", "-")
172
159
"Unicode-spaces"
173
160
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.
189
161
"""
190
162
191
163
defstruct re_pattern: nil , source: "" , opts: [ ]
192
164
193
- @ type t :: % __MODULE__ { re_pattern: term , source: binary , opts: binary | [ term ] }
165
+ @ type t :: % __MODULE__ { re_pattern: term , source: binary , opts: [ term ] }
194
166
195
167
defmodule CompileError do
196
168
@ moduledoc """
0 commit comments