public PersionName getPersionName(string sPersionName) { PersionName oPersionName = new PersionName(); Regex rxDetail = new Regex(@"htm"">([\w]+)", RegexOptions.IgnoreCase | RegexOptions.Singleline); Match mDetail = rxDetail.Match(sPersionName); oPersionName.name = mDetail.Groups[1].Value.ToString(); oPersionName.gioitinh = "male"; System.IO.File.AppendAllText(@"F:\name.txt", oPersionName.name + "\n"); return(oPersionName); }
public List <PersionName> ExtractPersionNameInfor() { listPersionName = new List <PersionName>(); foreach (var swebcontent in listWebContent) { MatchCollection mListPersonName = new Regex(@"id=""name_[\d].*?htm"">(\w+)", RegexOptions.Singleline | RegexOptions.IgnoreCase).Matches(swebcontent); if (mListPersonName.Count < 1) { return(null); } for (int i = 0; i < mListPersonName.Count; i++) { PersionName oPersionName = new PersionName(); oPersionName = getPersionName(mListPersonName[i].Value.ToString()); listPersionName.Add(oPersionName); } } return(listPersionName); }