积极答复者
请教c#正则表达式返回的结果

问题
答案
-
foreach(var m in Regex.Matches(yourStr,@"(?<=<%=).+?(?=%>)")) { m.Value;//这是否就是你要的? }
2011 c# mvp China. *George读起来像不像“饺子”?我爱吃饺子,我叫George。- 已建议为答案 Lie YouModerator 2011年4月14日 9:19
- 取消建议作为答案 naojin 2011年4月15日 5:52
- 已标记为答案 mldarkModerator 2011年4月16日 13:25
-
我是这样用的
foreach (Object m in System.Text.RegularExpressions.Regex.Matches(@"fafafafdsf\<\%=xyz\%\>attrwttewt\<\%=zy\%\>fa34rtt\<\%=tt\%\>",@"(?<=<%=).+?(?=\%\>)"))
{
Response.Write(m.ToString());
}
//饺子给出的正则是没有问题的 你自己使用的问题
foreach (Match m in System.Text.RegularExpressions.Regex.Matches(@"fafafafdsf<%=xyz%>attrwttewt<%=zy%>fa34rtt<%=tt%>",@"(?<=<%=).+?(?=%>)")) { <span style="font-size:11px; white-space:normal"> Response.Write</span>(m.Value); }
<br/>
Best Regards,
If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".- 已编辑 Tim Tang 2011年4月15日 7:34 <br/>
- 已建议为答案 Lie YouModerator 2011年4月15日 7:55
- 已标记为答案 mldarkModerator 2011年4月16日 13:25
全部回复
-
foreach(var m in Regex.Matches(yourStr,@"(?<=<%=).+?(?=%>)")) { m.Value;//这是否就是你要的? }
2011 c# mvp China. *George读起来像不像“饺子”?我爱吃饺子,我叫George。- 已建议为答案 Lie YouModerator 2011年4月14日 9:19
- 取消建议作为答案 naojin 2011年4月15日 5:52
- 已标记为答案 mldarkModerator 2011年4月16日 13:25
-
我是这样用的
foreach (Object m in System.Text.RegularExpressions.Regex.Matches(@"fafafafdsf\<\%=xyz\%\>attrwttewt\<\%=zy\%\>fa34rtt\<\%=tt\%\>",@"(?<=<%=).+?(?=\%\>)"))
{
Response.Write(m.ToString());
}
//饺子给出的正则是没有问题的 你自己使用的问题
foreach (Match m in System.Text.RegularExpressions.Regex.Matches(@"fafafafdsf<%=xyz%>attrwttewt<%=zy%>fa34rtt<%=tt%>",@"(?<=<%=).+?(?=%>)")) { <span style="font-size:11px; white-space:normal"> Response.Write</span>(m.Value); }
<br/>
Best Regards,
If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".- 已编辑 Tim Tang 2011年4月15日 7:34 <br/>
- 已建议为答案 Lie YouModerator 2011年4月15日 7:55
- 已标记为答案 mldarkModerator 2011年4月16日 13:25