Basic Tutorials | tutorials | regular Expressions | regular
Directory
Objective of this article
How to use this tutorial
What exactly is a regular expression?
Entry
Testing Regular Expressions
Metacharacters
Word Escape
Repeat
Character class
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
or a minus sign.
To avoid so many annoying repetitions, we can also write this expression: 0 "d {2}-" d {8 }. Here, "{2} ({8}) after D indicates that D must be repeated twice (eight times ).Test Regular Expression
Other available test tools:
Regexbuddy
Javascript Regular Expres
Regular Expression Overview Regular Expressions are widely used in programming languages, especially for processing strings. Such as matching strings, searching strings, and replacing strings. It can be said that a regular expression is a piece of text or a formula used to d
1 Why to understand engine matching principle
A jumble of notes, may be the noise, the same note through the composer's hand, you can draw a very beautiful music, a performer can also play the music of the melody, but he/she may not know how to change the combination of notes, make the music more beautiful.
As regular users also, do not understand the principle of the engine, the same can be written to meet the needs of the
The escape character in the Java language and the expression of the escape character in the regular syntax in the Java string.There are 14 escape characters in ASCLL:
\o
Null character (NULL)
00h/0
\ n
Line Break (LF)
0ah/10
\ r
Carriage return (CR)
expressions, so I recommend that I write to you. NET tool Regular expression tester. Please refer to the description of the page to install and run the software.
Metacharacters
Now you know a few very useful meta characters, such as \b,., *, and \d. There are more metacharacters in regular expressions, such as \s ma
follows:
VaR pattern = new Regexp ("S $ ");
It is easy to create a Regexp object, whether using a regular expression to directly count or using the constructor Regexp (). A more difficult task is to describe the character pattern using the regular expression syntax.Javascript uses a fairly complete subset of Perl's
. A more difficult task is to use regular expression syntax to describe the character mode. javascript uses a fairly complete subset of Perl's regular expression syntax.
The pattern specification of a regular expression is compose
"proficient in regular expression" in the name of "Look around", in fact, what does not matter, as long as you know what the role is, so a few grammatical rules, it is easy to remember
2-Glance matching principle
Looking around is a very difficult point in the regular, for the understanding of the look, you can understand from the application and the principle
regular expression syntax to describe the character mode. javaScript uses a fairly complete subset of Perl's regular expression syntax.
The pattern specification of a regular expression is composed of a series of characters. most
= new RegExp ("S $");It is easier to create a RegExp object either by using the regular expression directly or by using the constructor RegExp (). The more difficult task is to use regular expression syntax to describe the pattern of the character.JavaScript uses a fairly complete subset of the Perl language
is not a metacharacter. It only matches itself-a hyphen (or a hyphen ).
To avoid so many annoying repetitions, we can also write this expression: 0 \ d {2}-\ d {8 }. Here {2} ({8}) after \ d means that the previous \ d must be repeated twice (eight times ).
Test Regular Expression
Other available test tools:
RegexBuddyJavascript
letter characters that do not represent escape structures; they are reserved for future extension of the Regular Expression Language. You can use a backslash before a non-letter character, regardless of whether the character is a part of a non-escape structure.
According to the requirements of Java Language Specification, the backslash in the string of
constructor regexp (), it is easy to create a RegExp object. The more difficult task is 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
PHP Regular Expressions Getting Started tutorial (recommended), regular expression Getting started Tutorial
Mind Mapping
Click, you can see the specific content!
Introduced
Regular expression, everyone in the development should be often used, now a lot of development langu
.
Summary:
I learned the boundary and assertion (zero-width assertion ). If there is no summary, start the essence of the Regular Expression and continue to BB.
4. Selection, grouping, and backward reference
Select Operation:
Select operation can match one of multiple optional modes. For example, if you want to find the number of times that "the" (the, the, the) appears in the "the android developer need Fi
" is supported under UNIX, I suspect that it is possible that the other browser engine does not come from Windows and therefore does not provide support for "\ R", resulting in a regular "." Nor does it match "\ r". Not doing in-depth research, just a few guesses.
Common Application MistakesAttention
When matching multiple rows, do not attempt to match any character with "[. N]", which means only one of the decimal and newline characters, which you c
uses a fairly complete subset of Perl's regular expression syntax.The pattern specification of a regular expression is composed of a series of characters. most characters (including all letters, numbers, and characters) Describe character matching by literal meaning. in this way, the
Related reading:
Common regular expressions for iOS development
Java Regular Expressions filter out letters, numbers, and Chinese
A regular expression (regular expression) describes
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.