![]() |
|
![]() PHP FAQ PHP Articles PHP Help Bulletin Board PHP Manual (NEW!) First Time PHP'ers Help with programming Sql assignment help PHP Homework Help
|
LXXXVIII. Regular Expression Functions (Perl-Compatible)IntroductionThe syntax for patterns used in these functions closely resembles Perl. The expression should be enclosed in the delimiters, a forward slash (/), for example. Any character can be used for delimiter as long as it's not alphanumeric or backslash (\). If the delimiter character has to be used in the expression itself, it needs to be escaped by backslash. Since PHP 4.0.4, you can also use Perl-style (), {}, [], and <> matching delimiters. The ending delimiter may be followed by various modifiers that affect the matching. See Pattern Modifiers. PHP also supports regular expressions using a POSIX-extended syntax using the POSIX-extended regex functions.. RequirementsRegular expression support is provided by the PCRE library package, which is open source software, written by Philip Hazel, and copyright by the University of Cambridge, England. It is available at ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/. InstallationBeginning with PHP 4.2.0 these functions are enabled by default. You can disable the pcre functions with --without-pcre-regex. Use --with-pcre-regex=DIR to specify DIR where PCRE's include and library files are located, if not using bundled library. For older versions you have to configure and compile PHP with --with-pcre-regex[=DIR] in order to use these functions. The windows version of PHP has built in support for this extension. You do not need to load any additional extension in order to use these functions. Predefined ConstantsThe 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. Table 1. PREG constants
|