正则表达式也允许C#winforms中的空格 [英] Regular Expression that also allows for spaces in C# winforms

查看:101
本文介绍了正则表达式也允许C#winforms中的空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我正在使用正则表达式。它工作得很好但现在我需要修改,就像用户输入PartTime时一样,当用户输入Part Time时它会很好用不是那么基本可以任何身体引导我正则表达式可能只允许字符串(字符)与单词之间的空格。



目前我的正则表达式是

^ [a-zA-Z] + $



关注

解决方案





问候




它很简单,

试试这个



^ [a-zA-Z \] *






接受的输入

兼职

考试时间

派对时间结束




here [ ^ ]


希望这会对你有所帮助。



问候,

RK

Hello
I am working with regular expressions.It is working great but now i need modification like when the user enter "PartTime" it works well where as when user enters "Part Time" it does not so basically can any body guide me what regular expression might be that allows only strings ("characters") with spaces between words.

Currently my regular expression is
^[a-zA-Z]+$

Regards

解决方案



Regards


Hi,
Its just simple,
Try this

^[a-zA-Z\s]*




Accepted inputs
part time
Test time
Party time is over


Test this in here[^]

Hope this helps you a bit.

Regards,
RK


这篇关于正则表达式也允许C#winforms中的空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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