日期:2014-05-18  浏览次数:20917 次

弱弱的请教截取字符的问题
C# code

string s1= "<p>\r\n <img alt=\"\" src=\"/WEB/ckeditor_finder/userfiles/images/hx.jpg\" style=\"width: 200px; height: 199px;\" /></p>\r\n";

string s2 = "<p>\r\n uuuu</p>\r\n";

string r1 = s1.?
r1="<img alt=\"\" src=\"/WEB/ckeditor_finder/userfiles/images/hx.jpg\" style=\"width: 200px; height: 199px;\" />"
string r2 = s2.?
r2="uuuu";



------解决方案--------------------
string input=@"<p>\r\n uuuu</p>\r\n"
Match m=Regex.Match(input,@"<([^>]+)>\S*(.*?)</\1>\S*");
string value=m.Groups[2].Value;