From 4132a0a07ef524a660f56d70dd5c6e91c47a6fbc Mon Sep 17 00:00:00 2001 From: Eksperimental Date: Thu, 25 Sep 2025 14:43:45 -0500 Subject: [PATCH 1/2] Align Regex dotall modifier to PCRE2 --- lib/elixir/lib/regex.ex | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/elixir/lib/regex.ex b/lib/elixir/lib/regex.ex index d07f4479c2..8380813b68 100644 --- a/lib/elixir/lib/regex.ex +++ b/lib/elixir/lib/regex.ex @@ -76,9 +76,10 @@ defmodule Regex do * `:caseless` (i) - adds case insensitivity - * `:dotall` (s) - causes dot to match newlines and also set newline to - anycrlf; the new line setting can be overridden by setting `(*CR)` or - `(*LF)` or `(*CRLF)` or `(*ANY)` according to `:re` documentation + * `:dotall` (s) - causes dot to match newlines and also sets newline to + `(*ANYCRLF)`; the new line setting can be overridden by starting the + regular expression pattern with `(*CR)`, `(*LF)`, `(*CRLF)`, `(*ANY)` or + `(*NUL)` as described in the [`:re` documentation](`:re`) * `:multiline` (m) - causes `^` and `$` to mark the beginning and end of each line; use `\A` and `\z` to match the end or beginning of the string From 3af87ce05994e241c8f34519cdc3fe4700fb4521 Mon Sep 17 00:00:00 2001 From: Eksperimental Date: Thu, 25 Sep 2025 17:35:36 -0500 Subject: [PATCH 2/2] Rework dotall modifiers including Erlang/OTP 28+ exclusive sequence --- lib/elixir/lib/regex.ex | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/elixir/lib/regex.ex b/lib/elixir/lib/regex.ex index 8380813b68..db0b2ac263 100644 --- a/lib/elixir/lib/regex.ex +++ b/lib/elixir/lib/regex.ex @@ -3,6 +3,8 @@ # SPDX-FileCopyrightText: 2012 Plataformatec defmodule Regex do + # TODO: Remove the "Starting from Erlang/OTP 28" part in the Modifiers' + # section once Erlang/OTP 28+ is exclusively supported. @moduledoc ~S""" Provides regular expressions for Elixir. @@ -77,9 +79,15 @@ defmodule Regex do * `:caseless` (i) - adds case insensitivity * `:dotall` (s) - causes dot to match newlines and also sets newline to - `(*ANYCRLF)`; the new line setting can be overridden by starting the - regular expression pattern with `(*CR)`, `(*LF)`, `(*CRLF)`, `(*ANY)` or - `(*NUL)` as described in the [`:re` documentation](`:re`) + `(*ANYCRLF)`.\ + The new line setting, as described in the [`:re` documentation](`:re`), + can be overridden by starting the regular expression pattern with: + * `(*CR)` - carriage return + * `(*LF)` - line feed + * `(*CRLF)` - carriage return, followed by line feed + * `(*ANYCRLF)` - any of the three above + * `(*ANY)` - all Unicode newline sequences + * _Starting from Erlang/OTP 28, `(*NUL)` - the NUL character (binary zero)_ * `:multiline` (m) - causes `^` and `$` to mark the beginning and end of each line; use `\A` and `\z` to match the end or beginning of the string