The following is a collection of some of the regular expressions used to organize, to facilitate future reference in the work, I hereby record. can only enter a number: "^[0-9]*$" can only enter n digits: "^\d{n}$" can only enter at
PHP regular expressions are used primarily for string pattern segmentation, matching, lookup, and substitution operations. Using regular expressions can be inefficient in some simple environments, so how to better use PHP regular expressions
The characters you need to escape in a PHP regular expression are:
$^* () +={}[]|/:<>.? ' "
Note: The Perl-style expression requires a/start and end, such as:/food/table-matching characters food
The Perl modifiers are as follows:
I completes a
Mind Mapping
introduce
Regular expression, we should be often used in the development, now many development languages have regular expression of the application, such as javascript,java,.net,php, and so on, I today to the regular
We often process data from user input or read from the database, and may have extra blanks or tabs in your string, carriage return, and so on. Storing these extra characters is a bit of a waste of space.
If you want to get rid of the string start
Regular expression regular expressions are used for string processing, form verification, and so on, and are practical and efficient. This article collects some common expressions:
Matching regular expressions for Chinese characters: [\U4E00-\U9FA5]
PHP regular expressions are used primarily for string pattern segmentation, matching, lookup, and substitution operations. Using regular expressions can be inefficient in some simple environments, so how to better use PHP regular expressions
Regular summary: Collects some commonly used regular expressions.
Regular expressions are used for string processing, form validation, and so on, practical and efficient, but often not too sure to use, so it is always necessary to search the
I found that a lot of PHP programmers, especially learning is not a long time, do not know the essence of PHP. How did Perl become famous in the business world? Its powerful regular expression. And what about PHP? He is a language developed from
One, the following example can remove extra whitespace
The code is as follows
$STR = "This line containstliberal RN with Whitespace.nn";The leading/trailing whitespaceRemove the start and end blank Www.111cn.net$str =
One, what is Xml,xml's purpose?
XML (extensible Markup Language) expands the markup language, which, like HTML, is SGML (Standard generalized Markup Language, Standard Universal Markup Language). XML is a cross-platform, content-dependent
The definition of the PHP regular expression:
A syntax rule used to describe the character arrangement and matching pattern. It is mainly used for pattern segmentation, matching, lookup and substitution operations of strings.
Regular functions in
The essence I found a lot of PHP programmers, especially the study is not very long, do not know the essence of PHP. How did Perl become famous in the business world? Its powerful regular expression. And what about PHP? He is a language developed
str = ' People's Republic of China 123456789ABCDEFG ';
Echo Preg_match ("/^[\u4e00-\u9fa5_a-za-z0-9]{3,15}", StrName);
Run the code above to see what prompts?
Warning:preg_match (): compilation Failed:pcre does not support \l, \l, \ n, \p, \p, \u,
This article mainly introduces the use of regular expressions in PHP string search method, example analysis of the PHP regular expression of the use of skills, with a certain reference value, the need for friends can refer to the
The example in
Program | The essence of the software I found that a lot of PHP programmers, especially the study is not very long, do not know the essence of PHP. How did Perl become famous in the business world? Its powerful regular expression. And what about PHP?
There is such a section of HTML, more irregular, if you want to extract the link address and link name, how to do?
Html
$str = '歌曲列表中文金曲榜•轻音乐';
The use of regular expressions is the simplest, the other way, even rice to think ...
$pat = '/(
When learning PHP, you may encounter the problem of judging PHP regular expression, here will introduce the solution of the problem of PHP regular expression, here to share with you. In some query websites and search engines, it is often used to
Regular Expressions (Regular Expression, abbr. Regex) are powerful and can be used to find the information you need in a large string of words character. It takes advantage of the conventional character-structure expressions to function.
One, what is Xml,xml's purpose?
XML (extensible Markup Language) expands the markup language, which, like HTML, is SGML (Standard generalized Markup Language, Standard Universal Markup Language). XML is a cross-platform, content-dependent
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.