in daily work. As far as the author's experience is concerned, this goal is still well accomplished-you see, I can't write down everything myself, can I?
Clear format text format Conventions: Terminology metacharacters/syntax format part of the regular expression Regular Expression (used for analysis) to match the source string to a regular expression or a part of the description
Hidden Side Note: There are some comments on the right side of this article, mainly used to provide some relevant in
. As far as the author's experience is concerned, this goal is still well accomplished-you see, I can't write down everything myself, can I?
Clear format text format Conventions: Terminology metacharacters/syntax format part of the regular expression Regular Expression (used for analysis) to match the source string to a regular expression or a part of the description
Hidden Side Note: There are some comments on the right side of this article, mainly used to provide some relevant information, or
Regular Expressions and Regular Expressions1. What is a regular expression?
When writing a program or webpage that processes strings, it is often necessary to find strings that meet certain complex rules. Regular Expressions are tools used to describe these rules. In other words, a regular expression is the code that records text rules.
You may have used the wildcard (wildcard) for file search in Windows/Dos, that is, * and ?. If you want to find all the Word documents in a directory, you will s
, as listed in table 3. This means that the type of character you are looking for can be very special. Suppose you want to write a like condition that finds only non-alphanumeric characters-the WHERE clause as a result might inadvertently become very complex.
The POSIX character class must be contained in a list of characters indicated by square brackets ([]). For example, the regular expression [[: Lower:]] matches a lowercase alphabetic character, while [[: Lower:]]{5} matches five consecutiv
any string that contains the pattern. Example: ModeOnceWith stringThere once is a man from newyorkwho kept all of his cash in a bucket.is a match.The letters in the pattern (O-N-C-E) are literal characters, that is, they represent the letter itself, and the numbers are the same. Some other slightly more complex characters, such as punctuation and white characters (spaces, tabs, etc.), are used to escape sequences. All escape sequences begin with a ba
Regular Expression, Regular Expression
When writing a program for processing strings or accessing webpages, it is often necessary to find strings that meet certain complex rules. The regular expression is the delimiter tool that describes these rules. In other words, a regular expression is the code that records the lifecycle text rules.
It is very likely that you have used the wildcard (wildcard) used by the handler in Windows/Dos to search for the keystore file, that is, * and ?. If you want t
metacharacters in a list of characters are considered text, except for the caret (^) and hyphen (-) characters. Regular expressions can look complex because some metacharacters have multiple meanings that vary with context. ^ is such a meta character. If you use it as the first character of a word characters, it represents the characters of a word. Therefore, [^[:d igit:]] looks for a pattern that contains any non-numeric characters, and ^[[:d Igit:]
Summarize self -Regular Expressions 30-minute introductory tutorials (great) and rookie tutorialsWhat exactly is a regular expression?Regular expressions, also known as formal representations and regular representations (Regular expression, are often abbreviated in code as regex, RegExp, or re).Character is the most basic unit of computer software processing text, it may be letters, numbers, punctuation, spaces, newline characters, Chinese characters
What is regular expression?
When writing a program or webpage that processes strings, it is often necessary to find strings that meet certain complex rules. Regular Expressions are tools used to describe these rules. In other words,Regular ExpressionIs the code that records text rules.
You may have used the wildcard (wildcard) for file search in Windows/DOS, that is, * and ?. If you want to find all the Word documents under a directory, you will search*. Doc. Here, * is interpretedAny string. Li
1. What exactly is a regular expression?When writing a program or Web page that handles strings, there is often a need to find strings that match certain complex rules. Regular expressions are the tools used to describe these rules. In other words, the regular expression is the code that records the text rule. It is possible that you have used the wildcard character (wildcard) for file lookup under Windows/dos, which is * and ?. If you want to find all the Word documents in a directory, you will
character or expression: {n,m}
All lowercase English letters: [A-z]
All uppercase English letters: [A-z]
All Western characters: [^1-^127]
All Chinese characters and Chinese punctuation: [!^1-^127]
All Chinese characters (CJK Unified): [one-龥] or [a-﨩]
All Chinese punctuation: [! One-龥 ^1-^127]
All non-numeric characters: [!0-9]
The expression N to find:
Paragraph mark: ^p
Manual line Feed ↓:^l
separator, but when we write title is generally not use this punctuation. The reason is that spaces is generally used in English words or letters between the separation, so spaces generally used in English sites, Chinese site title is generally not used.
Use "hyphen" "-" to separate keywords in title
We found that a lot of site title will use this punctuation
d.
Except for the delimiters (^) and hyphens (-), most metacharacters in the character list are considered as text. Regular Expressions seem complicated because some metacharacters have multiple meanings that depend on the context. ^ Is such a metacharacter. If you use it as the first character of a character list, it represents the non. Therefore, [^ [: digit:] searches for matching modes that contain any non-numeric characters, and ^ [[: digit:] searches for matching modes that start with num
class, you can place individual characters in a character list. For example, the regular expression ^ AB [cd] EF $ matches the string abcef and abdef. Select C or D.
Except for the delimiters (^) and hyphens (-), most metacharacters in the character list are considered as text. Regular Expressions seem complicated because some metacharacters have multiple meanings that depend on the context. ^ Is such a metacharacter. If you use it as the first character of a character list, it represents the n
characters, automatic line feed not allowed pre-wrap: blank characters are not merged, and automatic line feed is allowed
[Note]
[Note] IE7-the browser does not support the pre-line and pre-wrap attribute values.
Text line feed
The browser provides the Text wrap function. The text container can wrap automatically on the right.
For English, the browser will automatically wrap the line in a space or a hyphen, instead of a sudden line break in the mi
effect of the separator. For example, such a title "Webmaster article, log, SEO articles, webmaster stories, online appreciation-webmaster Network, the title of the original intention is to let search engines know, this title contains the webmaster articles and other keywords, but if we use the Chinese comma, then the search engine will be the title as a long tail keyword , which is clearly against our original intention.
Second, the use of space "" details
The most common us
the handling of automatic line wrapping, through the specific property settings, not only can let the browser achieve half-width space or a hyphen after the line, but also allows the browser to implement any position of the line-wrappingSyntax and parameters: Word-break:normal | Break-all | Keep-allNormal: Default value, according to the language's own rules to determine the line-wrapping method, Chinese to the boundary of the man line, English from
(Reprinted) Regular Expression 30 minutes getting started tutorial Author: deerchao Source: unibetter? You may have used wildcards for file search in Windows/Dos, that is, * and ?. If you want to find all the Word documents in a directory, you will search for *. doc. Here, * is interpreted as any string. Like wildcards, regular expressions are also a tool for text matching, but they can describe your requirements more accurately than wildcards-of course, the cost is more complex. For example, yo
\b--Find text with "Elvis" followed by "Alive"
With just a few special characters we begin to create powerful regular expressions, and they are beginning to become difficult for us to understand.
Let's look at another example.
Determine the legality of the phone number
Suppose your Web page collects a customer's 7-bit phone number, and you want to verify that the phone number entered is in the correct format, "Xxx-xxxx", where each "X" is a number. The following expression searches the entire te
. The following table lists the order of precedence for the various regular expression operators, from highest priority to lowest priority:
operator
Description
/
Escape character
(), (?:), (?=), []
Parentheses and square brackets
*, +,?, {n}, {n,}, {n,m}
Qualifier
^, $,/anymetacharacter
Location and order
|
"or" action
Ordinary charactersNormal characters are made up of all print and nonpr
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.