正则表达式例子

正则表达式例子1

reg:

(/"/w.*/"[:]/"/w.*/")|(/"/w.*/"[:]/[/w.*/])

 

source:

{"domain":"mzwu.com",

"years":[2006,2007,2008,2009,2010]}

 

 

result:

"domain":"mzwu.com"

"years":[2006,2007,2008,2009,2010]

 

//-----

正则表达式例子2

//reg:

/(0/d{2,3}/)[-]?/d{8}|0/d{2,3}[-]?/d{8}

 

source:

{(028)-34567890

(231+38383743)

[(0211)-22323623]}

 

result:

(028)-34567890

(0211)-22323623

 

//-----

QQ号码:

reg:

^/d{5,12}$

 

result:5到12位数字

 

//-----

电子邮件:

reg:

/w+[@]/w+[.]/w+

 

source:

sjd28232@163.com

36327272@qq.com

28242_1@.

2e_2@263.com

 

result:

sjd28232@163.com

36327272@qq.com

2e_2@263.com

 

 

//-----

正则表达式例子3

//reg:

/"/w.*/"[:]/"/w.*/"

 

source:

source:

{"weatherinfo":

{"city":"北京",

"city_en":"beijing",

"date_y":"2011年5月31日",

"date":"辛卯年",

"week":"星期二",

"fchh":"18",

"cityid":"101010100",

"temp1":"18℃~32℃",

"temp2":"19℃~34℃",

"temp3":"23℃~33℃",

"temp4":"23℃~29℃",

"temp5":"18℃~31℃",

"temp6":"18℃~35℃",

"tempF1":"64.4℉~89.6℉",

"tempF2":"66.2℉~93.2℉",

"tempF3":"73.4℉~91.4℉",

"tempF4":"73.4℉~84.2℉",

"tempF5":"64.4℉~87.8℉",

"tempF6":"64.4℉~95℉",

"weather1":"多云转晴",

"weather2":"晴",

"weather3":"阴转多云",

"weather4":"多云转雷阵雨",

"weather5":"雷阵雨转阴",

"weather6":"晴",

"img1":"1",

"img2":"0",

"img3":"0",

"img4":"99"}}

 

result:

"city":"北京"

"city_en":"beijing"

"date_y":"2011年5月31日"

....

"temp1":"18℃~32℃"

"tempF1":"64.4℉~89.6℉"

....

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值