17715834 发表于 2013-3-8 14:40:21

如何用正则采集这个标签?

"farePrice":490.0,"fuelSurcharge":140.0,"marketFare":490.0,"otherCharges":0.0,"pnCMBCardMile":0.0,"policyNo":null,"remark":null,"returnPoint":0.0,"total":680.0},"adultFareIntl":null,"airlineCode":"JD","childFare":{"airportTax":0.0,"commission":{"agentFee":0.0,"agentPer":0.0,"policyCreateDate":null,"policyNo":null,"spFee":0.0,"spPer":0.0},"farePrice":490.0,"fuelSurcharge":70.0,"marketFare":490.0,"otherCharges":0.0,"pnCMBCardMile":0.0,"policyNo":null,"remark":null,"returnPoint":0.0,"total":560.0},"childFareIntl":null,"code":"WZZX","createDate":"2011-03-27T20:41:11","createId":"JD_CJH","description":"联动下浮","ei":"不得签转、仅限网站退票



以上这段代码,我想采集 开头的"farePrice":490.0 这里的490作为“价格”标签,但是这段代码是JSON里的数据,相同的代码有很多条,唯一能标识不同的就是"code":"WZZX"

请问如何写一个正确的正则采集内容?

17715834 发表于 2013-3-8 15:06:59

通过群里的大哥耐心的帮我解决了问题。
正则表达式如下:WZZX.*?farePrice":(?<content>[\d.]+),".{170,180}WZZX

xielipingxi 发表于 2013-3-9 15:22:20

你好,请联系QQ:1197089128,专业采集
页: [1]
查看完整版本: 如何用正则采集这个标签?