Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PHP 8.4] PCRE - PCRE2-v10.44 updates #4078

Merged
merged 3 commits into from
Nov 20, 2024
Merged

[PHP 8.4] PCRE - PCRE2-v10.44 updates #4078

merged 3 commits into from
Nov 20, 2024

Conversation

Ayesh
Copy link
Member

@Ayesh Ayesh commented Nov 16, 2024

  • Added note about /r modifier.
  • Regex sub-pattern quantifier changes.

More changes noted here and here.

Unicode script list here was not updated for quite a while. As of PHP 8.4.0, there are close to 230 scripts and 160 shorthand script names. The table would need a bigger update, and not part of the PR, but will be added in a future PR.

@Ayesh Ayesh added this to the PHP 8.4 milestone Nov 16, 2024
Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, one remark.

Comment on lines 1578 to 1591
Prior to PHP 8.4.0, an opening curly bracket that
appears in a position where a quantifier is not allowed, or
one that does not match the syntax of a quantifier, is taken
as a literal character. For example, {,6} is not a quantifier,
but a literal string of four characters.
as a literal character. For example, <literal>{,6}</literal>
is not a quantifier, but a literal string of four characters.

As of PHP 8.4.0, the PCRE extension is bundled with PCRE2 version 10.44,
which allows patterns such as <literal>\d{,8}</literal> and they are
interpreted as <literal>\d{0,8}</literal>.

Further, as of PHP 8.4.0, space characters around quantifiers such as
<literal>\d{0 , 8}</literal> and <literal>\d{ 0 , 8 }</literal> are allowed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly those should be 3 different <simpara> ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, it makes sense that we split them.

<simpara> <para>
image image

I tried with three <simpara> tags, and a separate <para>, I liked the second one because it puts all PHP 8.4 stuff together, and looks more compact. What do you think? I pushed with the <para> tag now, but if you think <simpara> makes more sense, I can quickly change to that too 🙏.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<simpara> is better than a <para> tag, it is just the grouping that matters here.

reference/pcre/pattern.syntax.xml Outdated Show resolved Hide resolved
reference/pcre/pattern.syntax.xml Outdated Show resolved Hide resolved
@Girgias Girgias merged commit c43393d into php:master Nov 20, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants