.Net中的正则表达式:\s识别哪些字符 [英] Regex in .Net: Which characters are recognized by \s

查看:112
本文介绍了.Net中的正则表达式:\s识别哪些字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿那边!

我有一个问题我没有在网上找到答案。

我使用以下代码删除我的空格string:

 Regex.Replace(Text, @  \s + string  .Empty)



但我还没有找到一个列表哪些字符被\在.Net中识别
我读过识别的字符因平台而异,所以可能有人能指出我正确的方向吗?



感谢您的帮助!

解决方案

 \s匹配空格([\\\的缩写] \ n \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\请看一下:正则表达式模式  


\s匹配任何空格字符 - http://msdn.microsoft.com/ en-us / library / az24scfc%28v = vs.110%29.aspx [ ^ ]。


Hey out there!
I have one question for which I haven't found an answer in the web.
I use the following code to remove whitespaces from my string:

Regex.Replace(Text, @"\s+", string.Empty)


But I haven't found a list which characters are recognized by \s in .Net
I've read that the recognized characters differ from platform to platform, so probably someone can point me in the right direction?

Thanks for you help!

解决方案

\s matches whitespace (short for [\f\n\r\t\v\u00A0\u2028\u2029]).



Please take a look at this : Regular Expressions patterns


\s matches any white space characters - http://msdn.microsoft.com/en-us/library/az24scfc%28v=vs.110%29.aspx[^].


这篇关于.Net中的正则表达式:\s识别哪些字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆