Let's start by looking at a regular expression like this:
/^a-z@ ([a-z0-9][-_]?[ a-z0-9]+) +[.] [A-z] {2,3} ([.] [A-z] {2})? $/i
Oh, look at the feeling worried. Make a statement in advance, don't be frightened, you will find it not so
1. Introduction to Getting StartedSimply put, regular expressions are a powerful tool that can be used for pattern matching and substitution. We can find regular expressions in almost all UNIX-based system tools, such as VI Editor, perl or PHP
In the previous article, we translated recursive Regular Expressions in Perl. in fact, regular expressions in many languages Support recursion, for example, PHP regular recursion described in this article. although the most common regular
Regular expressions can match complex string forms, much more than string-processing functions, but perform less efficiently, but can achieve very complex matches, as summarized below1, simple string matching, to determine whether the specified
The main task today is to compare the recent upload time and local time of the news, research reports, etc., to see if it's more than 1 hours, and then I programmed PHP.At first, I thought the home page on the need to deal with the text of the
. Match any single character such as A.C can be ABC,ASC,AAC,$ matches the end of a string such as t$ can make the last character a string of T^ Start of a match line such as ^a to match a string starting with a* Match 0 or more characters exactly in
In PHP applications, regular expressions are mainly used to:Regular match: matches the corresponding content according to the regular expressionRegular substitution: matches content according to regular expression and replacesRegular segmentation:
This article mainly introduces the use of regular expressions in PHP to extract Chinese Implementation notes. This article also describes regular expressions in Korean and Japanese, and provides implementation code and examples, you can refer to the
Three ways to write a delimiter:Regexpal tool (positive regular expression debug tool):The results can be displayed in real time.Atomic:Visible Atom, which is a character in the Uincode encoded tableInvisible atoms:In order to avoid coding problems
Review regular expressions in PHP (1) first review common regular expression functions in php.
1. preg_match () and preg_match_all ()
Int prag_match ($ pattern, $ subject, optional parameter $ matchs); only one match is performed, and the return
Use regular expression 1 in PHP and function 1) preg_match-for Regular Expression Matching. compatible with perl's regular syntax intpreg_match (string $ pattern, string $ subject [, array $ matches [, int $ flags] using regular expressions in PHP
1
Regular Expressions in PHP (i)
Hunte April 14, 2000
PHP inherits *nix's consistent tradition and fully supports the processing of regular expressions. Formal expressions provide an advanced, but not intuitive, method for string matching and
What is a regular expression?
A few years ago, I made some interesting tests on the Web form input box. The user will enter the phone number in this form. The phone number is then printed in the user's advertisement as the user typed. According to
strings and regular Expressions in PHP, PHP regular expressions
I. Characteristics of String types
1, PHP is a weakly typed language, other data types can be directly applied to string function operation.
1:
Output 345Output 345Look for Hello
A detailed description of the string and regular expressions in PHP, with a detailed description of the PHP regular expression
I. Characteristics of String types
1, PHP is a weakly typed language, other data types can be directly applied to string
Summary of common regular expressions in PHP
1, must be a combination of English, numeric string:
if (!preg_match ("/^ ([a-z]+[0-9]+) | ( [0-9]+[a-z]+)] {a-z0-9]*$/i ", $spend)) { return $this->_ajaxmessage (1, ' template ID must
2008-10-20 22:081. Introduction to Getting StartedSimply put, regular expressions are a powerful tool that can be used for pattern matching and substitution. We can find regular expressions in almost all UNIX-based system tools, such as VI Editor,
1. Delimiter:/Middle Write regular/2. ^ match start3. $ Match End4.2 appears any time5.2 + 2 appears at least once6.2? 2 appears 0 times or 1 times7.a{3} A appears 3 times8.a{2,} A appears at least 2 times and is limited to9.a{2,6} A appears at
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.