[DOC-CVS] [doc-en] master: Clarify that PCRE delimiters must be ASCII characters (#4817) (#5223)
[email protected] (Louis-Arnaud via GitHub)
| Newsgroups | php.doc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: Louis-Arnaud (lacatoire)
Committer: GitHub (web-flow)
Pusher: lacatoire
Date: 2026-08-26T10:12:59+02:00
Commit: https://github.com/php/doc-en/commit/61d512bfd7098a177b6490e0b478c72ed6fb90d6
Raw diff: https://github.com/php/doc-en/commit/61d512bfd7098a177b6490e0b478c72ed6fb90d6.diff
Clarify that PCRE delimiters must be ASCII characters (#4817) (#5223)
Multi-byte UTF-8 characters cannot be used as delimiters since they are
processed at the byte level.
Changed paths:
M reference/pcre/pattern.syntax.xml
Diff:
diff --git a/reference/pcre/pattern.syntax.xml b/reference/pcre/pattern.syntax.xml
index c87e73c4804e..2089643135d0 100644
--- a/reference/pcre/pattern.syntax.xml
+++ b/reference/pcre/pattern.syntax.xml
@@ -28,12 +28,20 @@
</section>
<section xml:id="regexp.reference.delimiters">
<title>Delimiters</title>
- <para>
+ <simpara>
When using the PCRE functions, it is required that the pattern is enclosed
by <emphasis>delimiters</emphasis>. A delimiter can be any non-alphanumeric,
- non-backslash, non-whitespace character.
+ non-backslash, non-whitespace single-byte character.
Leading whitespace before a valid delimiter is silently ignored.
- </para>
+ </simpara>
+ <note>
+ <simpara>
+ Multi-byte characters (such as UTF-8 encoded characters like <literal>§</literal>)
+ cannot be used as delimiters. PHP reads exactly one byte as the delimiter;
+ using a multi-byte character would cause the remaining bytes to be
+ misinterpreted as unknown pattern modifiers.
+ </simpara>
+ </note>
<para>
Often used delimiters are forward slashes (<literal>/</literal>), hash
signs (<literal>#</literal>) and tildes (<literal>~</literal>). The