111,115
社区成员




/// <summary>
/// 回车 换行
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public static string rep(string input)
{
input = Regex.Replace(input, "(?:\\)*(\r|\n)", "\\$1");
return input;
}
/// <summary>
/// 回车 换行
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public static string rep(string input)
{
input = Regex.Replace(input, "(?:\\\\)*(\r|\n)", "\\$1");
return input;
}
string s = "\r";
s = rep(s);
s = string.Format("alert('{0}')", s);
ClientScript.RegisterStartupScript(this.GetType(), "alert", s, true);
/// <summary>
/// 回车 换行
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public static string rep(string input)
{
string pattern = "(?:\\\\)*(\\r|\\n)";
input = Regex.Replace(input, pattern, "\\$1");
return input;
}
@"(?:\\)*(\r|\n)"
这个写法是有问题的。"(?:\\\\)*(\r|\n)"
@"(?:\\)*(\r|\n)", "\\$1"
input = Regex.Replace(input, "(?:\\)*(\r|\n)", "\\$1");