note 88423 added to pcre.constants

From: Date: Fri, 23 Jan 2009 13:22:05 +0000
Subject: note 88423 added to pcre.constants
Groups: php.notes 
Request: Send a blank email to php-notes+get-149688@lists.php.net to get a copy of this message
This function might come in handy to debug regular expressions in preg_.. calls function pcre_error_deocde() { switch (preg_last_error()) { case PREG_PATTERN_ORDER: print "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().\n"; break; case PREG_SET_ORDER: print "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().\n"; break; case PREG_OFFSET_CAPTURE: print "See the description of PREG_SPLIT_OFFSET_CAPTURE. This flag is available since PHP 4.3.0.\n"; break; case PREG_SPLIT_NO_EMPTY: print "This flag tells preg_split() to return only non-empty pieces.\n"; break; case PREG_SPLIT_DELIM_CAPTURE: print "This flag tells preg_split() to capture parenthesized expression in the delimiter pattern as well. This flag is available since PHP 4.0.5.\n"; break; case PREG_SPLIT_OFFSET_CAPTURE: print "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 available since PHP 4.3.0 and is only used for preg_split().\n"; break; case PREG_NO_ERROR: // do not print in this case //print "Returned by preg_last_error() if there were no errors. Available since PHP 5.2.0.\n"; break; case PREG_INTERNAL_ERROR: print "Returned by preg_last_error() if there was an internal PCRE error. Available since PHP 5.2.0.\n"; break; case PREG_BACKTRACK_LIMIT_ERROR: print "Returned by preg_last_error() if backtrack limit was exhausted. Available since PHP 5.2.0.\n"; break; case PREG_RECURSION_LIMIT_ERROR: print "Returned by preg_last_error() if recursion limit was exhausted. Available since PHP 5.2.0.\n"; break; case PREG_BAD_UTF8_ERROR: print "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). Available since PHP 5.2.0.\n"; break; case PREG_BAD_UTF8_OFFSET_ERROR: print "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). Available since PHP 5.3.0.\n"; break; case PCRE_VERSION: print "PCRE version and release date (e.g. '7.0 18-Dec-2006'). Available since PHP 5.2.4.\n"; break; } } ---- Server IP: 193.190.67.12 Probable Submitter: 195.122.110.8 ---- Manual Page -- http://www.php.net/manual/en/pcre.constants.php Edit -- https://master.php.net/note/edit/88423 Del: integrated -- https://master.php.net/note/delete/88423/integrated Del: useless -- https://master.php.net/note/delete/88423/useless Del: bad code -- https://master.php.net/note/delete/88423/bad+code Del: spam -- https://master.php.net/note/delete/88423/spam Del: non-english -- https://master.php.net/note/delete/88423/non-english Del: in docs -- https://master.php.net/note/delete/88423/in+docs Del: other reasons-- https://master.php.net/note/delete/88423 Reject -- https://master.php.net/note/reject/88423 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#149688) next »