[英]carriage Return regular expression
Im trying to match a carriage return in a .net regular expression so that we can replace it with a linebreak html tag we currently have: 我正在尝试匹配.net正则表达式中的回车符,以便我们可以用当前具有的换行html标记替换它:
public readonly static Regex CarriageReturn =
new Regex(@"^\r*$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
and then use it as:- 然后将其用作:-
StandardRegexes.CarriageReturn.Replace("xxxxxxxx", "<br/>")
this is currently not matching correctly 目前这不正确匹配
any advise would be appreciated 任何建议将不胜感激
试试这个,检查它是否有效:
\\r(?!\\n)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.