Predefined Constants
The constants below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime.
Constants | Description | As of |
---|---|---|
PREG_PATTERN_ORDER |
Orders results so that $matches[0] is an array of full pattern matches, $matches[1] is an array of strings matched by the first parenthesized subpattern, and so on. This flag is only used with preg_match_all(). | |
PREG_SET_ORDER |
Orders results so that $matches[0] is an array of first set of matches, $matches[1] is an array of second set of matches, and so on. This flag is only used with preg_match_all(). | |
PREG_OFFSET_CAPTURE |
See the description of
PREG_SPLIT_OFFSET_CAPTURE .
|
|
PREG_SPLIT_NO_EMPTY |
This flag tells preg_split() to return only non-empty pieces. | |
PREG_SPLIT_DELIM_CAPTURE |
This flag tells preg_split() to capture parenthesized expression in the delimiter pattern as well. | |
PREG_SPLIT_OFFSET_CAPTURE |
If this flag is set, for every occurring match the appendant string offset will also be returned. Note that this changes the return values in an array where every element is an array consisting of the matched string at offset 0 and its string offset within subject at offset 1. This flag is only used for preg_split(). | |
PREG_UNMATCHED_AS_NULL |
This flag tells preg_match() and
preg_match_all() to include unmatched subpatterns in
$matches as NULL values. Without this flag, unmatched
subpatterns are reported as empty strings, as if they were empty matches.
Setting this flag allows to distinguish between these two cases.
|
7.2.0 |
PREG_NO_ERROR |
Returned by preg_last_error() if there were no errors. | 5.2.0 |
PREG_INTERNAL_ERROR |
Returned by preg_last_error() if there was an internal PCRE error. | 5.2.0 |
PREG_BACKTRACK_LIMIT_ERROR |
Returned by preg_last_error() if backtrack limit was exhausted. | 5.2.0 |
PREG_RECURSION_LIMIT_ERROR |
Returned by preg_last_error() if recursion limit was exhausted. | 5.2.0 |
PREG_BAD_UTF8_ERROR |
Returned by preg_last_error() if the last error was caused by malformed UTF-8 data (only when running a regex in UTF-8 mode). | 5.2.0 |
PREG_BAD_UTF8_OFFSET_ERROR |
Returned by preg_last_error() if the offset didn't correspond to the begin of a valid UTF-8 code point (only when running a regex in UTF-8 mode). | 5.3.0 |
PREG_JIT_STACKLIMIT_ERROR |
Returned by preg_last_error() if the last PCRE function failed due to limited JIT stack space. | 7.0.0 |
PCRE_VERSION |
PCRE version and release date (e.g. "7.0 18-Dec-2006"). | 5.2.4 |
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-pcre.constants.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.