帮助正则表达式 [英] Help with regular expression

查看:114
本文介绍了帮助正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在学习正则表达式,我需要帮助找到一个来验证文本框中的数字,格式如下:



1111 111 11111



允许所有数字和两个空格

不允许每个其他角色



有人可以帮助

解决方案

尝试:

 ^ \d {4} \s\d {3} \s\d {5} 


假设任何数字序列,不允许前导或尾随或连续空格,则应执行以下操作:

^(?:\d +){2} \\ \\d +

Hi,
I am just learning about regular expressions and I need help finding one to validate a number in a text box that is in the following format

1111 111 11111

Allowed are all numbers and two spaces
not allowed every other character

Can someone help

解决方案

Try:

^\d{4}\s\d{3}\s\d{5}



Assuming any sequence of digits, no leading nor trailing nor consecutive spaces allowed, then the following should do:
^(?:\d+ ){2}\d+


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

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