| 1 |
<?php |
| 2 |
|
| 3 |
// Start of pcre v. |
| 4 |
|
| 5 |
/** |
| 6 |
* Perform a regular expression match |
| 7 |
* @link http://www.php.net/manual/en/function.preg-match.php |
| 8 |
* @param pattern string <p> |
| 9 |
* The pattern to search for, as a string. |
| 10 |
* </p> |
| 11 |
* @param subject string <p> |
| 12 |
* The input string. |
| 13 |
* </p> |
| 14 |
* @param matches array[optional] <p> |
| 15 |
* If matches is provided, then it is filled with |
| 16 |
* the results of search. $matches[0] will contain the |
| 17 |
* text that matched the full pattern, $matches[1] |
| 18 |
* will have the text that matched the first captured parenthesized |
| 19 |
* subpattern, and so on. |
| 20 |
* </p> |
| 21 |
* @param flags int[optional] <p> |
| 22 |
* flags can be the following flag: |
| 23 |
* |
| 24 |
* |
| 25 |
* PREG_OFFSET_CAPTURE |
| 26 |
* |
| 27 |
* |
| 28 |
* If this flag is passed, for every occurring match the appendant string |
| 29 |
* offset will also be returned. Note that this changes the value of |
| 30 |
* matches into an array where every element is an |
| 31 |
* array consisting of the matched string at offset 0 |
| 32 |
* and its string offset into subject at offset |
| 33 |
* 1. |
| 34 |
* @param offset int[optional] <p> |
| 35 |
* Normally, the search starts from the beginning of the subject string. |
| 36 |
* The optional parameter offset can be used to |
| 37 |
* specify the alternate place from which to start the search (in bytes). |
| 38 |
* </p> |
| 39 |
* |
| 40 |
* <p> |
| 41 |
* Using offset is not equivalent to passing |
| 42 |
* substr($subject, $offset) to |
| 43 |
* preg_match in place of the subject string, |
| 44 |
* because pattern can contain assertions such as |
| 45 |
* ^, $ or |
| 46 |
* (? |
| 47 |
* |
| 48 |
* &example.outputs; |
| 49 |
* |
| 50 |
* |
| 51 |
* <p> |
| 52 |
* while this example |
| 53 |
* </p> |
| 54 |
* |
| 55 |
* ]]> |
| 56 |
* |
| 57 |
* <p> |
| 58 |
* will produce |
| 59 |
* </p> |
| 60 |
* |
| 61 |
* Array |
| 62 |
* ( |
| 63 |
* [0] => def |
| 64 |
* [1] => 0 |
| 65 |
* ) |
| 66 |
* ) |
| 67 |
* ]]> |
| 68 |
* |
| 69 |
* |
| 70 |
* </p> |
| 71 |
* @return int preg_match returns 1 if the pattern |
| 72 |
* matches given subject, 0 if it does not, or false |
| 73 |
* if an error occurred. |
| 74 |
*/ |
| 75 |
function preg_match ($pattern, $subject, array &$matches = null, $flags = null, $offset = null) {} |
| 76 |
|
| 77 |
/** |
| 78 |
* Perform a global regular expression match |
| 79 |
* @link http://www.php.net/manual/en/function.preg-match-all.php |
| 80 |
* @param pattern string <p> |
| 81 |
* The pattern to search for, as a string. |
| 82 |
* </p> |
| 83 |
* @param subject string <p> |
| 84 |
* The input string. |
| 85 |
* </p> |
| 86 |
* @param matches array[optional] <p> |
| 87 |
* Normally, the search starts from the beginning of the subject string. |
| 88 |
* The optional parameter offset can be used to |
| 89 |
* specify the alternate place from which to start the search (in bytes). |
| 90 |
* </p> |
| 91 |
* |
| 92 |
* <p> |
| 93 |
* Using offset is not equivalent to passing |
| 94 |
* substr($subject, $offset) to |
| 95 |
* preg_match_all in place of the subject string, |
| 96 |
* because pattern can contain assertions such as |
| 97 |
* ^, $ or |
| 98 |
* (? |
| 99 |
* @param flags int[optional] <p> |
| 100 |
* Can be a combination of the following flags (note that it doesn't make |
| 101 |
* sense to use PREG_PATTERN_ORDER together with |
| 102 |
* PREG_SET_ORDER): |
| 103 |
* |
| 104 |
* |
| 105 |
* PREG_PATTERN_ORDER |
| 106 |
* |
| 107 |
* <p> |
| 108 |
* Orders results so that $matches[0] is an array of full |
| 109 |
* pattern matches, $matches[1] is an array of strings matched by |
| 110 |
* the first parenthesized subpattern, and so on. |
| 111 |
* </p> |
| 112 |
* <p> |
| 113 |
* |
| 114 |
* |
| 115 |
* ]]> |
| 116 |
* |
| 117 |
* &example.outputs; |
| 118 |
* |
| 119 |
* example: , this is a test |
| 120 |
* example: , this is a test |
| 121 |
* ]]> |
| 122 |
* |
| 123 |
* <p> |
| 124 |
* So, $out[0] contains array of strings that matched full pattern, |
| 125 |
* and $out[1] contains array of strings enclosed by tags. |
| 126 |
* </p> |
| 127 |
* |
| 128 |
* </p> |
| 129 |
* @param offset int[optional] |
| 130 |
* @return int the number of full pattern matches (which might be zero), |
| 131 |
* or false if an error occurred. |
| 132 |
*/ |
| 133 |
function preg_match_all ($pattern, $subject, array &$matches = null, $flags = null, $offset = null) {} |
| 134 |
|
| 135 |
/** |
| 136 |
* Perform a regular expression search and replace |
| 137 |
* @link http://www.php.net/manual/en/function.preg-replace.php |
| 138 |
* @param pattern mixed <p> |
| 139 |
* The pattern to search for. It can be either a string or an array with |
| 140 |
* strings. |
| 141 |
* </p> |
| 142 |
* <p> |
| 143 |
* Several PCRE modifiers |
| 144 |
* are also available, including the deprecated 'e' |
| 145 |
* (PREG_REPLACE_EVAL), which is specific to this function. |
| 146 |
* </p> |
| 147 |
* @param replacement mixed <p> |
| 148 |
* The string or an array with strings to replace. If this parameter is a |
| 149 |
* string and the pattern parameter is an array, |
| 150 |
* all patterns will be replaced by that string. If both |
| 151 |
* pattern and replacement |
| 152 |
* parameters are arrays, each pattern will be |
| 153 |
* replaced by the replacement counterpart. If |
| 154 |
* there are fewer elements in the replacement |
| 155 |
* array than in the pattern array, any extra |
| 156 |
* patterns will be replaced by an empty string. |
| 157 |
* </p> |
| 158 |
* <p> |
| 159 |
* replacement may contain references of the form |
| 160 |
* \\n or (since PHP 4.0.4) |
| 161 |
* $n, with the latter form |
| 162 |
* being the preferred one. Every such reference will be replaced by the text |
| 163 |
* captured by the n'th parenthesized pattern. |
| 164 |
* n can be from 0 to 99, and |
| 165 |
* \\0 or $0 refers to the text matched |
| 166 |
* by the whole pattern. Opening parentheses are counted from left to right |
| 167 |
* (starting from 1) to obtain the number of the capturing subpattern. |
| 168 |
* To use backslash in replacement, it must be doubled |
| 169 |
* ("\\\\" PHP string). |
| 170 |
* </p> |
| 171 |
* <p> |
| 172 |
* When working with a replacement pattern where a backreference is |
| 173 |
* immediately followed by another number (i.e.: placing a literal number |
| 174 |
* immediately after a matched pattern), you cannot use the familiar |
| 175 |
* \\1 notation for your backreference. |
| 176 |
* \\11, for example, would confuse |
| 177 |
* preg_replace since it does not know whether you |
| 178 |
* want the \\1 backreference followed by a literal |
| 179 |
* 1, or the \\11 backreference |
| 180 |
* followed by nothing. In this case the solution is to use |
| 181 |
* \${1}1. This creates an isolated |
| 182 |
* $1 backreference, leaving the 1 |
| 183 |
* as a literal. |
| 184 |
* </p> |
| 185 |
* <p> |
| 186 |
* When using the deprecated e modifier, this function escapes |
| 187 |
* some characters (namely ', ", |
| 188 |
* \ and NULL) in the strings that replace the |
| 189 |
* backreferences. This is done to ensure that no syntax errors arise |
| 190 |
* from backreference usage with either single or double quotes (e.g. |
| 191 |
* 'strlen(\'$1\')+strlen("$2")'). Make sure you are |
| 192 |
* aware of PHP's string |
| 193 |
* syntax to know exactly how the interpreted string will look. |
| 194 |
* </p> |
| 195 |
* @param subject mixed <p> |
| 196 |
* The string or an array with strings to search and replace. |
| 197 |
* </p> |
| 198 |
* <p> |
| 199 |
* If subject is an array, then the search and |
| 200 |
* replace is performed on every entry of subject, |
| 201 |
* and the return value is an array as well. |
| 202 |
* </p> |
| 203 |
* @param limit int[optional] <p> |
| 204 |
* The maximum possible replacements for each pattern in each |
| 205 |
* subject string. Defaults to |
| 206 |
* -1 (no limit). |
| 207 |
* </p> |
| 208 |
* @param count int[optional] <p> |
| 209 |
* If specified, this variable will be filled with the number of |
| 210 |
* replacements done. |
| 211 |
* </p> |
| 212 |
* @return mixed preg_replace returns an array if the |
| 213 |
* subject parameter is an array, or a string |
| 214 |
* otherwise. |
| 215 |
* </p> |
| 216 |
* <p> |
| 217 |
* If matches are found, the new subject will |
| 218 |
* be returned, otherwise subject will be |
| 219 |
* returned unchanged or &null; if an error occurred. |
| 220 |
*/ |
| 221 |
function preg_replace ($pattern, $replacement, $subject, $limit = null, &$count = null) {} |
| 222 |
|
| 223 |
/** |
| 224 |
* Perform a regular expression search and replace using a callback |
| 225 |
* @link http://www.php.net/manual/en/function.preg-replace-callback.php |
| 226 |
* @param pattern mixed <p> |
| 227 |
* The pattern to search for. It can be either a string or an array with |
| 228 |
* strings. |
| 229 |
* </p> |
| 230 |
* @param callback callable <p> |
| 231 |
* A callback that will be called and passed an array of matched elements |
| 232 |
* in the subject string. The callback should |
| 233 |
* return the replacement string. This is the callback signature: |
| 234 |
* </p> |
| 235 |
* <p> |
| 236 |
* |
| 237 |
* stringhandler |
| 238 |
* arraymatches |
| 239 |
* |
| 240 |
* </p> |
| 241 |
* <p> |
| 242 |
* You'll often need the callback function |
| 243 |
* for a preg_replace_callback in just one place. |
| 244 |
* In this case you can use an |
| 245 |
* anonymous function to |
| 246 |
* declare the callback within the call to |
| 247 |
* preg_replace_callback. By doing it this way |
| 248 |
* you have all information for the call in one place and do not |
| 249 |
* clutter the function namespace with a callback function's name |
| 250 |
* not used anywhere else. |
| 251 |
* </p> |
| 252 |
* <p> |
| 253 |
* |
| 254 |
* preg_replace_callback and |
| 255 |
* anonymous function |
| 256 |
* |
| 257 |
* ]]> |
| 258 |
* |
| 259 |
* |
| 260 |
* </p> |
| 261 |
* @param subject mixed <p> |
| 262 |
* The string or an array with strings to search and replace. |
| 263 |
* </p> |
| 264 |
* @param limit int[optional] <p> |
| 265 |
* The maximum possible replacements for each pattern in each |
| 266 |
* subject string. Defaults to |
| 267 |
* -1 (no limit). |
| 268 |
* </p> |
| 269 |
* @param count int[optional] <p> |
| 270 |
* If specified, this variable will be filled with the number of |
| 271 |
* replacements done. |
| 272 |
* </p> |
| 273 |
* @return mixed preg_replace_callback returns an array if the |
| 274 |
* subject parameter is an array, or a string |
| 275 |
* otherwise. On errors the return value is &null; |
| 276 |
* </p> |
| 277 |
* <p> |
| 278 |
* If matches are found, the new subject will be returned, otherwise |
| 279 |
* subject will be returned unchanged. |
| 280 |
*/ |
| 281 |
function preg_replace_callback ($pattern, $callback, $subject, $limit = null, &$count = null) {} |
| 282 |
|
| 283 |
/** |
| 284 |
* Perform a regular expression search and replace |
| 285 |
* @link http://www.php.net/manual/en/function.preg-filter.php |
| 286 |
* @param pattern mixed |
| 287 |
* @param replacement mixed |
| 288 |
* @param subject mixed |
| 289 |
* @param limit int[optional] |
| 290 |
* @param count int[optional] |
| 291 |
* @return mixed an array if the subject |
| 292 |
* parameter is an array, or a string otherwise. |
| 293 |
* </p> |
| 294 |
* <p> |
| 295 |
* If no matches are found or an error occurred, an empty array |
| 296 |
* is returned when subject is an array |
| 297 |
* or &null; otherwise. |
| 298 |
*/ |
| 299 |
function preg_filter ($pattern, $replacement, $subject, $limit = null, &$count = null) {} |
| 300 |
|
| 301 |
/** |
| 302 |
* Split string by a regular expression |
| 303 |
* @link http://www.php.net/manual/en/function.preg-split.php |
| 304 |
* @param pattern string <p> |
| 305 |
* The pattern to search for, as a string. |
| 306 |
* </p> |
| 307 |
* @param subject string <p> |
| 308 |
* The input string. |
| 309 |
* </p> |
| 310 |
* @param limit int[optional] <p> |
| 311 |
* If specified, then only substrings up to limit |
| 312 |
* are returned with the rest of the string being placed in the last |
| 313 |
* substring. A limit of -1, 0 or &null; means "no limit" |
| 314 |
* and, as is standard across PHP, you can use &null; to skip to the |
| 315 |
* flags parameter. |
| 316 |
* </p> |
| 317 |
* @param flags int[optional] <p> |
| 318 |
* flags can be any combination of the following |
| 319 |
* flags (combined with the | bitwise operator): |
| 320 |
* |
| 321 |
* |
| 322 |
* PREG_SPLIT_NO_EMPTY |
| 323 |
* |
| 324 |
* |
| 325 |
* If this flag is set, only non-empty pieces will be returned by |
| 326 |
* preg_split. |
| 327 |
* @return array an array containing substrings of subject |
| 328 |
* split along boundaries matched by pattern. |
| 329 |
*/ |
| 330 |
function preg_split ($pattern, $subject, $limit = null, $flags = null) {} |
| 331 |
|
| 332 |
/** |
| 333 |
* Quote regular expression characters |
| 334 |
* @link http://www.php.net/manual/en/function.preg-quote.php |
| 335 |
* @param str string <p> |
| 336 |
* The input string. |
| 337 |
* </p> |
| 338 |
* @param delimiter string[optional] <p> |
| 339 |
* If the optional delimiter is specified, it |
| 340 |
* will also be escaped. This is useful for escaping the delimiter |
| 341 |
* that is required by the PCRE functions. The / is the most commonly |
| 342 |
* used delimiter. |
| 343 |
* </p> |
| 344 |
* @return string the quoted (escaped) string. |
| 345 |
*/ |
| 346 |
function preg_quote ($str, $delimiter = null) {} |
| 347 |
|
| 348 |
/** |
| 349 |
* Return array entries that match the pattern |
| 350 |
* @link http://www.php.net/manual/en/function.preg-grep.php |
| 351 |
* @param pattern string <p> |
| 352 |
* The pattern to search for, as a string. |
| 353 |
* </p> |
| 354 |
* @param input array <p> |
| 355 |
* The input array. |
| 356 |
* </p> |
| 357 |
* @param flags int[optional] <p> |
| 358 |
* If set to PREG_GREP_INVERT, this function returns |
| 359 |
* the elements of the input array that do not match |
| 360 |
* the given pattern. |
| 361 |
* </p> |
| 362 |
* @return array an array indexed using the keys from the |
| 363 |
* input array. |
| 364 |
*/ |
| 365 |
function preg_grep ($pattern, array $input, $flags = null) {} |
| 366 |
|
| 367 |
/** |
| 368 |
* Returns the error code of the last PCRE regex execution |
| 369 |
* @link http://www.php.net/manual/en/function.preg-last-error.php |
| 370 |
* @return int one of the following constants (explained on their own page): |
| 371 |
* |
| 372 |
* PREG_NO_ERROR |
| 373 |
* PREG_INTERNAL_ERROR |
| 374 |
* PREG_BACKTRACK_LIMIT_ERROR (see also pcre.backtrack_limit) |
| 375 |
* PREG_RECURSION_LIMIT_ERROR (see also pcre.recursion_limit) |
| 376 |
* PREG_BAD_UTF8_ERROR |
| 377 |
* PREG_BAD_UTF8_OFFSET_ERROR (since PHP 5.3.0) |
| 378 |
*/ |
| 379 |
function preg_last_error () {} |
| 380 |
|
| 381 |
|
| 382 |
/** |
| 383 |
* Orders results so that $matches[0] is an array of full pattern |
| 384 |
* matches, $matches[1] is an array of strings matched by the first |
| 385 |
* parenthesized subpattern, and so on. This flag is only used with |
| 386 |
* preg_match_all. |
| 387 |
* @link http://www.php.net/manual/en/pcre.constants.php |
| 388 |
*/ |
| 389 |
define ('PREG_PATTERN_ORDER', 1); |
| 390 |
|
| 391 |
/** |
| 392 |
* Orders results so that $matches[0] is an array of first set of |
| 393 |
* matches, $matches[1] is an array of second set of matches, and so |
| 394 |
* on. This flag is only used with preg_match_all. |
| 395 |
* @link http://www.php.net/manual/en/pcre.constants.php |
| 396 |
*/ |
| 397 |
define ('PREG_SET_ORDER', 2); |
| 398 |
|
| 399 |
/** |
| 400 |
* See the description of |
| 401 |
* PREG_SPLIT_OFFSET_CAPTURE. |
| 402 |
* @link http://www.php.net/manual/en/pcre.constants.php |
| 403 |
*/ |
| 404 |
define ('PREG_OFFSET_CAPTURE', 256); |
| 405 |
|
| 406 |
/** |
| 407 |
* This flag tells preg_split to return only non-empty |
| 408 |
* pieces. |
| 409 |
* @link http://www.php.net/manual/en/pcre.constants.php |
| 410 |
*/ |
| 411 |
define ('PREG_SPLIT_NO_EMPTY', 1); |
| 412 |
|
| 413 |
/** |
| 414 |
* This flag tells preg_split to capture |
| 415 |
* parenthesized expression in the delimiter pattern as well. |
| 416 |
* @link http://www.php.net/manual/en/pcre.constants.php |
| 417 |
*/ |
| 418 |
define ('PREG_SPLIT_DELIM_CAPTURE', 2); |
| 419 |
|
| 420 |
/** |
| 421 |
* If this flag is set, for every occurring match the appendant string |
| 422 |
* offset will also be returned. Note that this changes the return |
| 423 |
* values in an array where every element is an array consisting of the |
| 424 |
* matched string at offset 0 and its string offset within subject at |
| 425 |
* offset 1. This flag is only used for preg_split. |
| 426 |
* @link http://www.php.net/manual/en/pcre.constants.php |
| 427 |
*/ |
| 428 |
define ('PREG_SPLIT_OFFSET_CAPTURE', 4); |
| 429 |
define ('PREG_GREP_INVERT', 1); |
| 430 |
|
| 431 |
/** |
| 432 |
* Returned by preg_last_error if there were no |
| 433 |
* errors. |
| 434 |
* @link http://www.php.net/manual/en/pcre.constants.php |
| 435 |
*/ |
| 436 |
define ('PREG_NO_ERROR', 0); |
| 437 |
|
| 438 |
/** |
| 439 |
* Returned by preg_last_error if there was an |
| 440 |
* internal PCRE error. |
| 441 |
* @link http://www.php.net/manual/en/pcre.constants.php |
| 442 |
*/ |
| 443 |
define ('PREG_INTERNAL_ERROR', 1); |
| 444 |
|
| 445 |
/** |
| 446 |
* Returned by preg_last_error if backtrack limit was exhausted. |
| 447 |
* @link http://www.php.net/manual/en/pcre.constants.php |
| 448 |
*/ |
| 449 |
define ('PREG_BACKTRACK_LIMIT_ERROR', 2); |
| 450 |
|
| 451 |
/** |
| 452 |
* Returned by preg_last_error if recursion limit was exhausted. |
| 453 |
* @link http://www.php.net/manual/en/pcre.constants.php |
| 454 |
*/ |
| 455 |
define ('PREG_RECURSION_LIMIT_ERROR', 3); |
| 456 |
|
| 457 |
/** |
| 458 |
* Returned by preg_last_error if the last error was |
| 459 |
* caused by malformed UTF-8 data (only when running a regex in UTF-8 mode). |
| 460 |
* @link http://www.php.net/manual/en/pcre.constants.php |
| 461 |
*/ |
| 462 |
define ('PREG_BAD_UTF8_ERROR', 4); |
| 463 |
|
| 464 |
/** |
| 465 |
* Returned by preg_last_error if the offset didn't |
| 466 |
* correspond to the begin of a valid UTF-8 code point (only when running |
| 467 |
* a regex in UTF-8 |
| 468 |
* mode). |
| 469 |
* @link http://www.php.net/manual/en/pcre.constants.php |
| 470 |
*/ |
| 471 |
define ('PREG_BAD_UTF8_OFFSET_ERROR', 5); |
| 472 |
|
| 473 |
/** |
| 474 |
* PCRE version and release date (e.g. "7.0 18-Dec-2006"). |
| 475 |
* @link http://www.php.net/manual/en/pcre.constants.php |
| 476 |
*/ |
| 477 |
define ('PCRE_VERSION', "8.34 2013-12-15"); |
| 478 |
|
| 479 |
// End of pcre v. |
| 480 |
?> |