Parsing POSIX vs. Perl standard Regular expression differences---PHP

Source: Internet
Author: User
Tags learn php posix expression engine

Regular Expressions (Regular expression, abbreviated as Regexp,regex or REGXP), also known as regular expressions, regular expressions, or regular or normalized representations or formal representations, refer to a A single string that describes or matches a series of strings that conform to a certain syntactic rule. In many text editors or other tools, regular expressions are often used to retrieve and/or replace text content that conforms to a pattern. Many programming languages support the use of regular expressions for string manipulation. For example, in Perl, a powerful in-regular expression engine is built in. The concept of regular expressions was initially popularized by tools software (such as SED and grep) in Unix. (Excerpt from Wikipedia)

PHP uses two regular expression rules at the same time, one set is the POSIX Extended 1003.2 compliant regular by the Institute of Electrical and Electronics Engineers (IEEE) (In fact PHP is not perfect for this standard), and the other set comes from Pcre (Perl Compatible Regular Expression) Library provides Perl-compatible regular, an open-source software, the author of Philip Hazel.

It is recommended to use the Pcre (Perl Compatible Regular Expression) library to provide Perl-compliant regularization, which is more efficient than POSIX.

Fast learning: A quick way to learn PHP regular expressions POSIX-style and compatible Perl-style regular expression of the two main functions of the Regex fast-track table

The functions that use POSIX compliant rules are:
Ereg_replace ()
Ereg ()
Eregi ()
Eregi_replace ()
Split ()
Spliti ()
Sql_regcase ()
Mb_ereg_match ()
Mb_ereg_replace ()
Mb_ereg_search_getpos ()
Mb_ereg_search_getregs ()
Mb_ereg_search_init ()
Mb_ereg_search_pos ()
Mb_ereg_search_regs ()
Mb_ereg_search_setpos ()
Mb_ereg_search ()
Mb_ereg ()
Mb_eregi_replace ()
Mb_eregi ()
Mb_regex_encoding ()
Mb_regex_set_options ()
Mb_split ()

The functions that use Perl compatibility rules are:
Preg_grep ()
Preg_replace_callback ()
Preg_match_all ()
Preg_match ()
Preg_quote ()
Preg_split ()
Preg_replace ()

< reference: http://php.net/manual/zh/intro.pcre.php & http://www.jb51.net/article/38630.htm &/http Www.css119.com/book/regexp/>

Parsing POSIX vs. Perl standard Regular expression differences---PHP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.