File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -5554,7 +5554,7 @@ defmodule Kernel do
5554
5554
quote ( do: List . to_charlist ( unquote ( unescape_list_tokens ( pieces ) ) ) )
5555
5555
end
5556
5556
5557
- @ doc """
5557
+ @ doc ~S """
5558
5558
Handles the sigil `~r` for regular expressions.
5559
5559
5560
5560
It returns a regular expression pattern, unescaping characters and replacing
@@ -5564,12 +5564,15 @@ defmodule Kernel do
5564
5564
5565
5565
## Examples
5566
5566
5567
- iex> Regex.match?(~r( foo) , "foo")
5567
+ iex> Regex.match?(~r/ foo/ , "foo")
5568
5568
true
5569
5569
5570
5570
iex> Regex.match?(~r/a#{:b}c/, "abc")
5571
5571
true
5572
5572
5573
+ While the `~r` sigil allows parens and brackets to be used as delimiters,
5574
+ it is preferred to use `"` or `/` to avoid escaping conflicts with reserved
5575
+ regex characters.
5573
5576
"""
5574
5577
defmacro sigil_r ( term , modifiers )
5575
5578
You can’t perform that action at this time.
0 commit comments