如何使用正则表达式在两位数之后接受空格 [英] How to Accept space after two digits using Regular expression

查看:77
本文介绍了如何使用正则表达式在两位数之后接受空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



任何人都可以建议我如何使用正则表达式进行轰鸣声格式。

68 10 19 22



i我试图使用

来实现上述格式^ [0-9] {2} [] {1} {0-9} {2} [] {1} {0 -9} {2} [] {1} {0-9} {2} $这个表达式但它不起作用。

先谢谢你。

解决方案

这个表达但它不起作用。

先谢谢。


一个非常简单的方法是:

 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ 


请看我对这个问题的评论。问题没有完全定义,但是,如果你注意这个元素,你很可能会解决这个简单的问题:\ s(空白空间)。



另一个错误: {0-9} (背后有什么想法?: - ))你需要的地方 [0-9]



你需要学习如何使用我自己一起做这么简单的事情。我花了几秒钟修理它,但请自己动手。



-SA

Hi,
can any one suggest me how to do bellow format using regular expression.
68 10 19 22

i am trying to implement above format using
"^[0-9]{2}[ ]{1}{0-9}{2}[ ]{1}{0-9}{2}[ ]{1}{0-9}{2}$" this expression but its not working.
Thanks in Advance.

解决方案

" this expression but its not working.
Thanks in Advance.


A very simple way is :

\d\d\s\d\d\s\d\d\s\d\d


Please see my comment to the question. The problem is not fully defined, but, most likely, you will solve this simple problem if you pay attention for this element: \s (blank space).

Another mistake: {0-9} (what was the idea behind that? :-)) where you need [0-9].

You need to learn how to compose such simple things all by yourself. It took me few seconds to fix it, but please do it yourself.

—SA


这篇关于如何使用正则表达式在两位数之后接受空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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