Qt正则表达式小结
sales1.xls
orders3.xls
sales2.xls
sales3.xls
apac1.xls
europe2.xls
na1.xls
na2.xls
sa1.xls
sam.xls
ca1.xls
cA1.xls
Ca1.xls
CA1.xls
***********************************************
正则表达式:
.a.\.xls
结果:
na1.xls
na2.xls
sa1.xls
ca1.xls
Ca1.xls
***********************************************
正则表达式:
.a.
结果:
sal
sal
sal
ap
na1
na2
sa1
ca1
Ca1
***********************************************
正则表达式:
sales.
结果:
sales1
sales2
sales3
***********************************************
正则表达式:
.a
结果:
sa
sa
sa
a
pa
na
na
sa
ca
Ca
***********************************************
正则表达式:
[ns]a.\.xls
结果:
na1.xls
na2.xls
sa1.xls
***********************************************
正则表达式:
[Cc][aA].\.xls
结果:
ca1.xls
cA1.xls
Ca1.xls
CA1.xls
***********************************************
正则表达式:(^表示非)
[ns]a[^0-9]\.xls
结果:
sam.xls
***********************************************
var myArray = new Array();
...
if( myArray[0] == 0 ){
...
}
正则表达式:
myArray\[0\]
结果:
myArray[0]
***********************************************
\aaa\bb\c
正则表达式:
\\
结果:
\
\
\
***********************************************
This is a block of of text , serveral words here are are repeated , and and they should not be.
正则表达式:
[ ]+(\w+)[ ]+\1
结果:
of of
are are
and and
***********************************************
<BODY>
<h1>Welcome to my Homepage</h1>
Content is divided into two sections:<BR>
<h2>ColdFusion</h2>
Information about Macromedia ColdFusion.
<h2>Wireless</h2>
Information about Bluetooth,802.11,and more.
<h2>This is not valid HTML</h3>
<\BODY>
正则表达式:
结果:
***********************************************
正则表达式:
<[hH]([1-6])>.*</[hH]\1>
说明:\1用来匹配数字的
结果:
<h1>Welcome to my Homepage</h1>
<h2>ColdFusion</h2>
Information about Macromedia ColdFusion.
<h2>Wireless</h2>
***********************************************
Hello , ac.Ben@forta.com.cn is my email address
正则表达式:
[\w\.]+@[\w\.]+\.\w+
结果:
ac.Ben@forta.com.cn
***********************************************
NO.1:$23.45
NO.2:$3.45
NO.3:$123.45
NO.4:$1123.45
NO.5:$22223.45
NO.6:$0.45
正则表达式:
\$[0-9.]+
结果:
$23.45
$3.45
$123.45
$1123.45
$22223.45
$0.45
***********************************************
I paid $30 for 100 apples, 50 oranges,and 60 peers.I saved $5.2 on this order.
正则表达式:
\$[0-9.]+
结果:
$30
$5.2
***********************************************
123-456-7890
(123)456-7890
(123)-456-7890
(123-456-7890
123-456-7890
1234567890
123 456 7890
正则表达式:
\(?\d{3}\)?-?\d{3}-\d{4}
结果:
123-456-7890
(123)456-7890
(123)-456-7890
123-456-7890
***********************************************
I'm Tom, he is Jack
正则表达式:
Tom|Jack
结果:
Tom
Jack
***********************************************
Let's go go go!
正则表达式:
(go\s*)+
结果:
go go go
***********************************************
$10.9,¥20.5
正则表达式:
¥(\d+\.?\d*)
结果:
¥20.5
***********************************************
<li><a href=" http://ssss/xxxx.shtml" target="_blank">记录</a>< >
正则表达式:
>([^<>]+)<
结果:
记录
***********************************************
WiNdows 98, WindoWs NT, WindOws 2000
正则表达式:
[Ww][Ii][Nn][Dd][Oo][Ww][Ss] (?=NT|XP)
结果:
WindoWs
***********************************************
xxxdccccdaaaaa
正则表达式:
(d)(\w+)
结果:
dccccdaaaaa
***********************************************
xxxdccccdvvvvvdwwwwwdaaaaa
正则表达式:
(d)(\w+)(d)
结果:
dccccdvvvvvdwwwwwd