如果再加上groups使用就便方便!!,用括號來分割你要的group
html content :
<span id="ctl00_ContentPlaceHolder1_ctl00_FormView1_preschoolLabel">市立中正高工</span>
註:\s+表示空白間隔
Mathc = Regex.Matches(profileHtml, "<span\\s+id=\"(ctl00_ContentPlaceHolder1_ctl00_FormView1.*)\">(.*)</span>");
for (int i = 0; i < Mathc.Count; i++)
{
//get regex group
string g1 = Mathc[i].Groups[1].Value;
//ctl00_ContentPlaceHolder1_ctl00_FormView1_preschoolLabel
string g2 = Mathc[i].Groups[2].Value;
//市立中正高工
}
沒有留言:
張貼留言
留個話吧:)