"tag":"0","hpmax":"330","actortype":"1"
"tag":"1","hpmax":"340","actortype":"1"
"tag":"2","hpmax":"350","actortype":"1"
"tag":"3","hpmax":"360","actortype":"1"
"tag":"4","hpmax":"370","actortype":"1"
如上面一组数据,我想匹配到330 340 350 360 370
求教
js正则匹配符号中间
答案:1 悬赏:40 手机版
解决时间 2021-12-25 17:14
- 提问者网友:蓝莓格格巫
- 2021-12-25 03:44
最佳答案
- 五星知识达人网友:青灯有味
- 2022-01-10 04:02
按照你的要求编写的Javascript语言的匹配符号中间数据的程序如下<br><script type=text/javascript><br> var str='"tag":"0","hpmax":"330","actortype":"1"\r\n"tag":"1","hpmax":"340","actortype":"1"\r\n"tag":"2","hpmax":"350","actortype":"1"\r\n"tag":"3","hpmax":"360","actortype":"1"\r\n"tag":"4","hpmax":"370","actortype":"1"';<br> var regex=/"hpmax"\:"([0-9]+)"/ig;<br> var result;<br> while((result=regex.exec(str))!=null)<br> alert(result[1]);<br></script><br><br>运行结果<br>330<br>340<br>350<br>360<br>370
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯