Scenario: the content of a character string is matched, and the character string is changed to another one. However, the client of the released version must support string matching of the old version. Example: Old string: android3601.0 New String: androidaaa3601.0 now want to write a regular table... scenario:
The content of a character string is matched, and the character string is changed to another one. However, the client of the released version m
PHP extension text processing -- PCRE regular expression syntax 6 -- Character class (square brackets) and optional path (|)
Character class (square brackets)
The left square brackets start the description of a character class and end with square brackets. A separate right brace has no special meaning. If a Right square bracket needs to be a member of a character
$string='April15,2003';$pattern='/(\w+)(\d+),(\d+)/i';$replacement='${1},${3}';echo preg_replace($pattern,$replacement,$string);?>
The result of this expression is april1,2003Cause: (\w+) can match April15 completely, but because (\d+) is behind (\w+), in order to be able to match defined rules, (\w+) matches April1, (\d+) matches 5You can change the expression to avoid this situation such as:$pattern = '/
Regular Expression matching analysis process (Regular Expression matching principle), regular expression matching
There have been many articles about regular expressions. As we use more
Objective
Regular expression is cumbersome, but powerful, after the application of learning will let you in addition to improve efficiency, will give you a sense of absolute achievement. As long as the careful reading of these materials, coupled with the application of a certain reference, master regular expression is
Regular expression is regular expression, it seems that English is better than Chinese understand more, is to check expression characters
Not meet the rules!! Regular expressions have a very powerful and very complex object regexp
Signed on the Internet too much of the introduction is a fierce essay, while looking at the understanding can help memory not. Also by Wubi font root table formula "managed to watch 32 Jin ..." Inspiration,
Try "Regular Expression mnemonics" also known as "regular Limerick", version 0.1, absolutely original, counterfeit must investigate,:
Note: This article is on
There have been several articles about regular expressions, and as we use regular expressions more and more, we want to optimize performance and reduce our regular expression-writing matching bugs. We have to delve further into the regular
Regular expressions, also known as formal representations, formal representations, regular expressions, regular expressions, regular representations (English: Regular Expression, often abbreviated as regex, RegExp, or re) in code.
Function Description: This method can compile the specified regular expression, the execution speed of the regular expression after compilation increases, and if the regular expression is invoked multiple times, calling the compil
Take the mailbox verification, most people on the Internet write the mailbox validation regular expression code can not verify this mailbox:
i@julying.com, nor can you verify xxxxxx@i.com .
Last I found that youku.com (Youku) User registration has this problem, see figure:
Differences between regular expression creation methods and simple regular expression compiling methods (js learning summary), regular expression js
In the literal mode, all the content we wrap between them are metacharacters, and
function is given in table 6. The main difference between the two functions is that regexp_instr lets you specify a pattern rather than a specific search string; So it provides more functionality. The following example uses REGEXP_INSTR to return a string to the starting position of the five-bit ZIP code mode in CA 91234, Joe Smith, 10045 Berry Lane, San Joseph. If the regular expression is written as [[:d
In this case, the regular expression optimization, mainly for the current commonly used NFA pattern regular expressions, in detail can be referred to: regular expression matching parsing process analysis (regular
characters that are specifically used to represent them. For example, the + number matches the pattern of copying the previous pattern one or more times. The following table lists the replication syntax. First look at an example:
/\d{2, 4}///match numbers between 2 and 4.
/\W{3} \d?///Match three single characters and an arbitrary number.
/\s+java\s+///matches the string "Java", and can have one or more spaces before and after that string.
/[^ "] *///Match 0 or more non-quote characters.
Copy
can be used.
Special Character "? "It is equal to {0, 1}, and both represent" 0 or 1 previous content "or" previous content is optional ". So the example just now can be simplified:
^ \-? [0-9] {0 ,}\.? [0-9] {0,} $
The special characters "*" and {0,} are equal. They all represent "0 or multiple front content ". Finally, the character "+" is equal to {1,}, indicating "one or more previous content". Therefore, the preceding four examples can be writte
Regular Expressions in detail (II.)
The following are new objects that are not regular expressions see the corresponding JavaScript object's Properties $_ Property Reference Input $* property
Reference Multiline $ Property Reference Lastmatch $+ Property Reference Lastparen $ ' property
Reference Leftcontext $ ' Property Reference Rightcontext compile method to compile
PHP Regular Expression full manual, regular expression full manual
Full Manual of regular expressions for PHP
Objective
Regular expressions are cumbersome, but powerful, learned applications will give you an absolute sense of acc
string.
Re =new REGEXP ("a");/The simplest regular expression will match the letter A
Re=new RegExp ("A", "I");//The second parameter, which indicates that the match is not case-insensitive
The first parameter of the RegExp constructor is the text content of the regular expression, and the first argument i
expression as a string.
Re =new REGEXP ("a");/The simplest regular expression will match the letter A
Re=new RegExp ("A", "I");//The second parameter, which indicates that the match is not case-insensitive
The first parameter of the RegExp constructor is the text content of the regular
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.