正则怎么获取我要的信息啊
flashvalue = "<set name='07日06时' value='45' color='#07FD04' />"flashvalue += "<set name='07日07时' value='51' color='#FFFF00' />"
flashvalue += "<set name='07日08时' value='53' color='#FFFF00' />"
flashvalue += "<set name='07日09时' value='54' color='#FFFF00' />"
flashvalue += "<set name='07日10时' value='55' color='#FFFF00' />"
flashvalue += "<set name='07日11时' value='57' color='#FFFF00' />"
flashvalue += "<set name='07日15时' value='67' color='#FFFF00' />"
flashvalue += "<set name='07日16时' value='74' color='#FFFF00' />"
flashvalue += "<set name='07日17时' value='77' color='#FFFF00' />"
flashvalue += "<set name='07日18时' value='79' color='#FFFF00' />"
flashvalue += "<set name='07日19时' value='82' color='#FFFF00' />"
flashvalue += "<set name='07日21时' value='83' color='#FFFF00' />"
flashvalue += "<set name='07日22时' value='85' color='#FFFF00' />"
flashvalue += "<set name='07日23时' value='88' color='#FFFF00' />"
flashvalue += "<set name='08日01时' value='93' color='#FFFF00' />"
flashvalue += "<set name='08日02时' value='95' color='#FFFF00' />"
flashvalue += "<set name='08日03时' value='94' color='#FFFF00' />"
flashvalue += "<set name='08日04时' value='94' color='#FFFF00' />"
flashvalue += "<set name='08日05时' value='97' color='#FFFF00' />"
flashvalue += "<set name='08日06时' value='98' color='#FFFF00' />"
flashvalue += "<set name='08日09时' value='98' color='#FFFF00' />"
flashvalue += "<set name='08日10时' value='97' color='#FFFF00' />"
flashvalue += "<set name='08日11时' value='93' color='#FFFF00' />"
flashvalue += "<set name='08日13时' value='100' color='#FFFF00' />"
比如以上的信息,我想用正则就获取日期和value值,然后返回一个数组给我
我用replace我可以的到我想要的,但我想用MatchCollection这样我就能直接获得了,但这里 MatchCollection matchs = Regex.Matches(source, pattern);pattern怎么写啊?
replace的话这样写就可以了Regex.Replace(value, "flashvalue.*([0-9]+[日|月][0-9]+[时|日]).*value='([0-9]+)'.*", "$1:$2");
求解啊,第一次发帖