/// <summary>
/// 输出哪个格式化文本
/// </summary>
/// <param name="text">用户输入的文本</param>
/// <param name="maxLength">文本的最大长度</param>
/// <returns>格式化完的版本</returns>
public static string InputText(string text, int maxLength)
{
text = text.Trim();
if (string.IsNullOrEmpty(text))
return string.Empty;
if (text.Length > maxLength)
text = text.Substring(0, maxLength);
text = Regex.Replace(text, "[//s]{2}", "");
text = Regex.Replace(text, "(<[b][B][r][R]/*>)+|(<[p][P](.|//n)*?>)", "/n"); //<br>
text = Regex.Replace(text, "(//s*&[n][N][b][B][s][S][p][P];//S*)+", " "); //
text = Regex.Replace(text, "<(.|//n)*?>", string.Empty); //any other tags
text = text.Replace("'", "''");
return text;
}
public static void SearchRedirect(string key)
{
HttpContext.Current.Response.Redirect(string.Format(REDIRECT_URL, InputText(key,255)));
}