请帮忙写一正则表达式
字符串: <br/> UserName: AV-6009034 <br/> Password: 61fxe72opj <br/> <br/> UserName: AV-5974303 <br/> Password: p9stc1r5vb <br/> <br/> UserName: AV-6016790 <br/> Password: 95hh667r9a <br/> <br/>
希望得到的结果:
m.Groups[0].Value:
UserName: AV-6009034
Password: 61fxe72opj
m.Groups[1].Value:
UserName: AV-5974303
Password: p9stc1r5vb
................
------解决方案--------------------UserName:( ){2}(? <UserName> AV-\d{7})\ <br/\> +Password:( ){2}(? <Password> [\w\d]{10})
m.Group[ "UserName "]
m.Group[ "Password "]
------解决方案--------------------try
string test = " <br/> UserName: AV-6009034 <br/> Password: 61fxe72opj <br/> <br/> UserName: AV-5974303 <br/> Password: p9stc1r5vb <br/> <br/> UserName: AV-6016790 <br/> Password: 95hh667r9a <br/> <br/> ";
test = test.Replace( " ", " ");
test = test.Replace( " <br/> ", "\n ");
MatchCollection mc = Regex.Matches(test, @ "UserName:\s+\S+\s*Password:\s+\S+ ", RegexOptions.IgnoreCase);
foreach (Match m in mc)
{
richTextBox2.Text += m.Value + "\n\n ";
}