110,539
社区成员
发帖
与我相关
我的任务
分享
我想把下面的的ip地址替换为对应的地址
string allhtm="<P><FONT face="宋体">方式的方式的192.168.1.1我啊66</FONT></P><P><FONT face="宋体">220.220.6.1哈哈哈日442</FONT></P>";
string pattern1 = @"(\d+).(\d+).(\d+).1";
//有一个ip对应的替换类已经通过了测试
//ipchaxun i=new ipchaxun();
//string ip="117.27.219.1";
//string dizhi=i.getplacename(ip);
//下面的这句我写通不过
string kk=Regex.Replace(allhtm,pattern1,i.getplacename($1.$2.$3);,RegexOptions.RightToLeft);
string allhtm = "<P><FONT face=\"宋体\">方式的方式的192.168.1.1我啊66</FONT></P><P><FONT face=\"宋体\">220.220.6.1哈哈哈日442</FONT></P>";
string pattern1 = @"(\d+\.\d+\.\d+\.1)";
allhtm = Regex.Replace(allhtm, pattern1, i.getplacename("$0"));
Regex rg = new Regex(pattern1,RegexOptions.RightToLeft);
MatchEvaluator myEvaluator = new MatchEvaluator(i.getplacename);
richTextBox1.Text = rg.Replace(allhtm, myEvaluator);