Read about unix regular expression examples, The latest news, videos, and discussion topics about unix regular expression examples from alibabacloud.com
PHP regular expression syntax reprinted from: http://blog.csdn.net/kkobebryant/article/details/267527
Basic regular expression syntax
First, let's take a look at two special characters: '^' and '$'. they are used to match the start and end of the string, respectively.
"^ The": matches strings starting with ";"Of de
.
RgxpRequired option. A regular expression object that contains the regular expression pattern and the available flags.
Description
The Sarh method indicates whether a corresponding match exists. If a match is found, the Sarh method returns an integer value indicating the offset from the start of the matching dista
return character
\s matches a blank character, including \n,\r,\f,\t,\v, etc.
\s matches a non-white-space character equal to/[^\n\f\r\t\v]/
\ t matches a tab
\v matches a heavy-straight tab
\w matches a character that can make up a word (alphanumeric, which is my transliteration, with numbers), including underscores, like [\w] matches 5 in "$5.98", equal to [a-za-z0-9]
\w matches a character that cannot be composed of words, such as [\w] matches $ in "$5.98", equal to [^a-za-z0-9].
Having sa
Regular ExpressionsEdit regular expressions, also known as formal representations, general representations (English: Regular Expression, often abbreviated as regex, RegExp, or re) in code, a concept of computer science. A regular express
,} ' cannot match ' o ' in ' Bob ', but can match all o in ' Foooood '. ' O{1,} ' is equivalent to ' o+ '. ' O{0,} ' is equivalent to ' o* '.{n,m} m and n are non-negative integers, where n ? When the character immediately follows any other restriction (*, +,?, {n}, {n,}, {n,m}), the matching pattern is non-greedy. The non-greedy pattern matches the searched string as little as possible, while the default greedy pattern matches as many of the searched strings as possible. For example, for the st
before, and provide a high degree of flexibility.
Basic examples of regular expressionsBefore using this new feature, you need to understand the meaning of some meta characters. a period (.) matches any character in a regular expression (except for line breaks). For example, a re
: start at 6, end at 10. The separately obtained parenthesis range matches to the content: "20.5".
2. Some advanced rules in regular expressions 2.1 greedy and non-greedy in the number of matchesWhen using special symbols with decorated matches, there are several representations that allow the same expression to match a different number of times, such as: "{m,n}", "{m,}", "?", "*", "+", and the number
important to add a checksum to a rule if it is only to verify that the character composition and format do not make much sense. Due to the existence of leap years, the calibration of the date becomes more complicated.
First look at the effective range of dates and what is a leap year.
rules for the period of 2nd
2.1 Valid range for date
For a valid range of dates, different scenarios vary.
The valid ranges for DateTime objects defined in MSDN are: 0001-01-01 00:00:00 to 9999-12-31 23:59:59.
T
PHP Regular Expression modifier/I,/is,/s,/isU, regular expression isu
Before learning the PHP Regular Expression modifier, we should first understand the greedy mode. We mentioned above in the metacharacters "? "Another important
Detailed explanation of the assertion of the regular expression zero-width, and assertion of the Regular Expression
Assertion with zero width is a method in regular expressions. in computer science, a regular
The following examples illustrate the use of regular expressions to handle problems that are common in some jobs.
1.
Regexp_substr
The REGEXP_SUBSTR function uses regular expressions to specify the start and end points of the return string, and to return the same string as the VARCHAR2 or CLOB data in the source_string character set.
Grammar:
--1.regexp_substr th
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
There are two sets of regular expression libraries in PHP that are similar in functionality, but have slightly different execution efficiencies:
A set is provided by the Pcre (Perl compatible Regular Expression) library. A function named after a prefix using "preg_";
A set of (PHP default) extensions provided by POSIX
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
, with the following examples:
"^the": The beginning must have "the" string;
"Of despair$": The end must have a string of "of despair";
So
"^abc$": a string that requires the beginning of ABC and the end of ABC, which is actually only an ABC match;
"Notice": matches a string containing notice;
You can see if you don't use the two characters we mentioned (the last example), which means that the pattern (regular
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
to take a look.
The following figure shows the matching process using a regular expression:
The general matching process of a regular expression is as follows: Compare the expression with the characters in the text in sequence. If each character can match, the matching suc
Quick start of regular Expressions (ii)
"Guided reading" in this article, we mainly introduce subpatterns, reverse reference (back references) and quantifiers (quantifiers)
In the previous article, we introduced the pattern modifiers and metacharacters of regular expressions, and the attentive reader may find that this section is very brief and there are few practical e
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 regular
above metacharacters in regular expressions through examples.// S +/the above regular expression can be used to match one or more space characters in the target object./// D000/if we have a complex financial statement in hand, we can easily find all the total amount of RMB through the above
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.