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
to use regular expression syntax to describe the pattern of characters. JavaScript is a fairly complete subset of the regular expression syntax for Perl language .
The pattern specification for regular expressions is made up of a series of characters. Most characters, inclu
Overview of regular Expressions
Regular expressions are widely used in programming languages, especially for processing strings. such as matching strings, finding strings, replacing strings, and so on. It can be said that a regular expression is a piece of text or a formula, it is used to describe a pattern to match
functions, and sometimes implementing a complex function requires writing very long regular expressions, and how to match them exactly is a test of a programmer's ability.
2, simple and convenient
Usually we are doing string content lookup, we can only do a specific string lookup, but the regular expression can help us to do Fuzzy Lookup, faster and more conveni
-]+) *@[\\w-]+ (\\.[ \\w-]+) +$ "//email address
"^[a-za-z]+://(\\w+ (-\\w+) *) (\ \\w+ (-\\w+) *)) * (\\?\\s*) $ "//url
"^[a-za-z0-9_]*$"
The use of regular expressions in the detailed
Brief introduction
In short, regular expressions are a powerful tool that can be used for pattern matching and substitution. Its role is as follows:
Tests a pattern of a string. For example, you can test an input string to s
, and approximately 3 days after 400 years, thus reducing the 400 leap year in every three years. Leap year calculation, summed up is usually said: four years a leap, hundred years does not leap, 400 year again leap.
2.3 Format of the date
Depending on the language and culture, the hyphen of the date will vary, usually in the following formats:
YyyyMMdd
Yyyy-mm-dd
Yyyy/mm/dd
yyyy. Mm.dd
Regular expression
PHP regular expression full manual, regular expression full manual
Php regular expression full manual
Preface
Regular Expressions are cumbersome, but they are powerful. The application
NFA constructs a specific extension of a regular expression to achieve a successful match, it can capture the subexpression matching and matching reverse references. However, because of the traditional NFA backtracking, it can access the exact same state multiple times (if the state is reached through a different path). Therefore, at worst, it can perform very slowly. Because the traditional NFA accepts th
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
Detailed explanation of matching a single character in the regular expression tutorial, detailed explanation of the Regular Expression
This document describes how to match a single character in the regular expression tutorial. We
meaning
{N,m}
Matches the previous item at least n times, but not more than m times
{N,}
Match the previous item at least n times
N
Match the previous top n times
?
Matches the previous item 0 or 1 times, which means the previous item is optional, equivalent to {0,1}
+
Matches 1 or more times before, equivalent to {1,}
*
Matches 0 or more times before, equivalent to {0,}
Here ar
clusters
7.3_ OK repeat occurrence
1. Intro
At present, regular expressions have been widely used in many software applications, including *nix (Linux, UNIX, etc.), HP and other operating systems, Php,c#,java and other development environments, as well as many applications, can see the shadow of regular expression.
T
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
PHP regular expression full tutorial basics, regular expression full tutorial
At present, regular expressions have been widely used in many software applications, including * nix (Linux, Unix, etc.), HP and other operating systems, PHP, C #,
As with the MySQL comprehensive optimization detailed in the previous writing, it is because such tools are widely used, so a comprehensive optimization strategy for such tools is a good deal, because whether you're a programmer in PHP, Perl, Python, C + +, C #, Java, and so on, You are very likely to use a tool such as MySQL, regular expressions.
Let's say something you may not know. Knowledge of
At present, regular expressions have been widely used in many software applications, including *nix (Linux, UNIX, etc.), HP and other operating systems, Php,c#,java and other development environments, as well as many applications, can see the shadow of regular expression.
The use of
up of a series of characters. Most characters, including all alphanumeric characters, describe characters that are matched literally. In this case, the regular expression/java/and all of the containing substring "Java" String. Although the other characters in the regular
. The specific descriptions are as follows:
Character
Replace text
$1, $2,..., $99
Text that matches the 1st to 99 subexpressions in regexp
$
String Matching regexp
$'
Text on the left of the matched substring
$'
Text on the right of the matched substring
$
Direct Volume symbol
Let's take a look at the following example:
// 1. Replace with a subexpression: var str = "javascript"; str.
the right of the matching substring
$$
Direct measure Symbol
Take a look at the example:
1, with the child expression replacement: $, $
var str = "JavaScript";
Str.replace (/(Java) (script)/, ' $2$1 ');
The expression () is a subexpression that corresponds to the contents of the first exp
substring is already all characters, there is no second matched substring.
Mode:. * + foo (occupied mode): Also called occupied mode. When the match starts, all strings are read. The match with p1 is successful, but no other strings are matched with p2. Therefore, the matching fails. .
To put it simply, the greedy mode is different from the possession mode,Greedy mode reduces the number of successful matching modes from more to less, and leaves the characters to other modes for matching; th
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.