<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Predefined Constants</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="pcre.resources.html">Resource Types</a></div> <div class="next" style="text-align: right; float: right;"><a href="pcre.examples.html">Examples</a></div> <div class="up"><a href="book.pcre.html">PCRE</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="pcre.constants" class="appendix"> <h1>Predefined Constants</h1> <p class="simpara"> 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. </p> <table class="doctable table"> <caption><strong>PREG constants</strong></caption> <thead> <tr> <th>constant</th> <th>description</th> <th>since</th> </tr> </thead> <tbody class="tbody"> <tr id="constant.preg-pattern-order"> <td><strong><code>PREG_PATTERN_ORDER</code></strong></td> <td> Orders results so that <var class="varname"><var class="varname">$matches[0]</var></var> is an array of full pattern matches, <var class="varname"><var class="varname">$matches[1]</var></var> is an array of strings matched by the first parenthesized subpattern, and so on. This flag is only used with <span class="function"><a href="function.preg-match-all.html" class="function">preg_match_all()</a></span>. </td> <td class="empty"> </td> </tr> <tr id="constant.preg-set-order"> <td><strong><code>PREG_SET_ORDER</code></strong></td> <td> Orders results so that <var class="varname"><var class="varname">$matches[0]</var></var> is an array of first set of matches, <var class="varname"><var class="varname">$matches[1]</var></var> is an array of second set of matches, and so on. This flag is only used with <span class="function"><a href="function.preg-match-all.html" class="function">preg_match_all()</a></span>. </td> <td class="empty"> </td> </tr> <tr id="constant.preg-offset-capture"> <td><strong><code>PREG_OFFSET_CAPTURE</code></strong></td> <td> See the description of <strong><code>PREG_SPLIT_OFFSET_CAPTURE</code></strong>. </td> <td>4.3.0</td> </tr> <tr id="constant.preg-split-no-empty"> <td><strong><code>PREG_SPLIT_NO_EMPTY</code></strong></td> <td> This flag tells <span class="function"><a href="function.preg-split.html" class="function">preg_split()</a></span> to return only non-empty pieces. </td> <td class="empty"> </td> </tr> <tr id="constant.preg-split-delim-capture"> <td><strong><code>PREG_SPLIT_DELIM_CAPTURE</code></strong></td> <td> This flag tells <span class="function"><a href="function.preg-split.html" class="function">preg_split()</a></span> to capture parenthesized expression in the delimiter pattern as well. </td> <td>4.0.5</td> </tr> <tr id="constant.preg-split-offset-capture"> <td><strong><code>PREG_SPLIT_OFFSET_CAPTURE</code></strong></td> <td> 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 <span class="function"><a href="function.preg-split.html" class="function">preg_split()</a></span>. </td> <td>4.3.0</td> </tr> <tr id="constant.preg-unmatched-as-null"> <td><strong><code>PREG_UNMATCHED_AS_NULL</code></strong></td> <td> This flag tells <span class="function"><a href="function.preg-match.html" class="function">preg_match()</a></span> and <span class="function"><a href="function.preg-match-all.html" class="function">preg_match_all()</a></span> to include unmatched subpatterns in <var class="varname"><var class="varname">$matches</var></var> as <strong><code>NULL</code></strong> 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. </td> <td>7.2.0</td> </tr> <tr id="constant.preg-no-error"> <td><strong><code>PREG_NO_ERROR</code></strong></td> <td> Returned by <span class="function"><a href="function.preg-last-error.html" class="function">preg_last_error()</a></span> if there were no errors. </td> <td>5.2.0</td> </tr> <tr id="constant.preg-internal-error"> <td><strong><code>PREG_INTERNAL_ERROR</code></strong></td> <td> Returned by <span class="function"><a href="function.preg-last-error.html" class="function">preg_last_error()</a></span> if there was an internal PCRE error. </td> <td>5.2.0</td> </tr> <tr id="constant.preg-backtrack-limit-error"> <td><strong><code>PREG_BACKTRACK_LIMIT_ERROR</code></strong></td> <td> Returned by <span class="function"><a href="function.preg-last-error.html" class="function">preg_last_error()</a></span> if <a href="pcre.configuration.html#ini.pcre.backtrack-limit" class="link">backtrack limit</a> was exhausted. </td> <td>5.2.0</td> </tr> <tr id="constant.preg-recursion-limit-error"> <td><strong><code>PREG_RECURSION_LIMIT_ERROR</code></strong></td> <td> Returned by <span class="function"><a href="function.preg-last-error.html" class="function">preg_last_error()</a></span> if <a href="pcre.configuration.html#ini.pcre.recursion-limit" class="link">recursion limit</a> was exhausted. </td> <td>5.2.0</td> </tr> <tr id="constant.preg-bad-utf8-error"> <td><strong><code>PREG_BAD_UTF8_ERROR</code></strong></td> <td> Returned by <span class="function"><a href="function.preg-last-error.html" class="function">preg_last_error()</a></span> if the last error was caused by malformed UTF-8 data (only when running a regex in <a href="reference.pcre.pattern.modifiers.html" class="link">UTF-8 mode</a>). </td> <td>5.2.0</td> </tr> <tr id="constant.preg-bad-utf8-offset-error"> <td><strong><code>PREG_BAD_UTF8_OFFSET_ERROR</code></strong></td> <td> Returned by <span class="function"><a href="function.preg-last-error.html" class="function">preg_last_error()</a></span> if the offset didn't correspond to the begin of a valid UTF-8 code point (only when running a regex in <a href="reference.pcre.pattern.modifiers.html" class="link">UTF-8 mode</a>). </td> <td>5.3.0</td> </tr> <tr id="constant.preg-jit-stacklimit-error"> <td><strong><code>PREG_JIT_STACKLIMIT_ERROR</code></strong></td> <td> Returned by <span class="function"><a href="function.preg-last-error.html" class="function">preg_last_error()</a></span> if the last PCRE function failed due to limited JIT stack space. </td> <td>7.0.0</td> </tr> <tr id="constant.pcre-version"> <td><strong><code>PCRE_VERSION</code></strong></td> <td> PCRE version and release date (e.g. "<em>7.0 18-Dec-2006</em>"). </td> <td>5.2.4</td> </tr> </tbody> </table> </div> <hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="pcre.resources.html">Resource Types</a></div> <div class="next" style="text-align: right; float: right;"><a href="pcre.examples.html">Examples</a></div> <div class="up"><a href="book.pcre.html">PCRE</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>