Skip to content

Document "\x{...}" and "\N{U+...}" Unicode escapes in PCRE patterns #5404

@masakielastic

Description

@masakielastic

Affected page

https://www.php.net/manual/en/regexp.reference.escape.php

Current issue

The PHP manual page describing escape sequences in PCRE patterns
(regexp.reference.escape.php) currently does not document two Unicode
escape syntaxes supported by PCRE2:

  • \x{hhhh}
  • \N{U+hhhh}

Both forms allow matching a Unicode character by its code point and are
supported by the PCRE2 engine.

Adding these escape sequences to the documentation would improve
completeness and help users write portable Unicode-aware regular
expressions.

reference:
https://pcre2project.github.io/pcre2/doc/pcre2pattern/

Suggested improvement

\x{hhhh}

Matches the Unicode character whose code point is U+hhhh.

\N{U+hhhh}

Matches the Unicode character whose code point is U+hhhh.

Additional context (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions