JS 利用正则表达式替换字符串
JS 利用正则表达式替换字符串 var data = "123123,213,12312,312,3,Caat,cat,dsfsdfs,"; var reCat = /\bc([a-z]|[A-Z]|[0-9])*t\b/ig; //•g(全文查找);•i(忽略大小写);•m(多行查找) var res = data.replace(reCat,"AAA"); 输出:123123,213,12312,312,3,AAA,AAA,dsfsdfs, var data = "src=\"http://img6.nanhao360.com/p11/20130812/962-b82c-2b.jpg\" height="; var reCat = /\bhttp:\/\/([a-z]|[A-Z]|[0-9]|\/|\.|-)*\.([jpg]|[png]|[gif])+\b/ig; var res = data.replace(reCat,"AAA"); 输出:src="AAA" height=
相关推荐
wangzhaotongalex 2020-10-20
wyq 2020-11-11
TLROJE 2020-10-26
风雨断肠人 2020-10-13
duanqingfeng 2020-09-29
rechanel 2020-11-16
cshanzhizi 2020-10-16
luofuIT成长记录 2020-09-22
phphub 2020-09-10
taomengxing 2020-09-07
MaggieRose 2020-08-19
flyingssky 2020-08-18
山水沐光 2020-08-18
jyj00 2020-08-15
AHuqihua 2020-08-09
山水沐光 2020-08-03