Regular expressions are tools that can be used for pattern matching and replacement, allowing users to build matching mode by using a series of special characters, then compare matching mode with the comparison string or file, depending on the comparison object Match mode, perform the corresponding program; regular expression starts
Unix
System, currently widely used in various scripting languages,
PHP
,
Perl
,
JavaScript
Can find his figure. The most common place for regular expressions is
Web
Determine if the user entered the email address is correct.
See in detail:
Http://www.phpe.net/articles/268.shtml http://www.donews.net/aiting/archive/2004/09/10/95072.aspx ------------ -------------------------------------------------- -
You give me an email, I will send it to you the rules of expressions. You can
UltraEdit
Use the "Find" in the "Find".
Regular expression rules are as follows:
expression
description
expression
description
^
Match
$
Matched
.
Match any single character
[]
Character in matching collection
[^]
Matching characters in the collection
?
Match the previous style
0
or
1
Secondary
*
Match the previous style
0
Or more
Match the previous style
1
Or more
|
Match the previous or last style
&
Match the previous style
0
Or more
#
Match the previous style
1
Or more
{} Group char to form one pattern () Group and Remember /
The next character is directly used (only
A-Z
Outside character is valid)
<
The beginning of the match
>
End of matching words
/ x ##
match
ASCII
Code
##
(
16
Compamine character
/ N ###
match
ASCII
Code
##
(
10
Compamine character
/ o ###
match
ASCII
Code
##
(
8
Compamine character
/ a
match
/ a / b
match
/ b / f
match
/ f / r
match
0x13
Bus stop
) / T
match
0x09 (
Jumping
) / V
match
/ v / e
match
ESC (0x05) / N
match
0x10
Wrap
) / S
Match space
(
Enter, wrap, player, space
) / S
Match non-spaced
(! / s) / w
Whole word match
/ W
Non-finger matching
/ d
Matching numbers
/ D
Match non-numbers
/ U
Match uppercase letters
/ L
Match lowercase letters
/ C
Behind the case sensitive
/ c
Behind the case is not sensitive
/ #
Match the group of front definitions
(#: 1-9, a-f)
Let's take some examples to explain the usage of regular expressions:
1.
Find lines ending with empty characters:
[/ x20 / t] $ 2.
Find space line
^ $ 3.
Look up
12.34 / $ 12/.34 4.
Find legal
C
Language variable name:
/ <[A-ZA-Z] [A-ZA-Z0-9] * 5.
Find the prosthetic expression
([^ ()] *)