数字的正则表达式,长度为4,5或6 [英] Regular expression for number with length of 4, 5 or 6
本文介绍了数字的正则表达式,长度为4,5或6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一个正则表达式来验证长度为4,5,6的数字
I need a regular expression that validate for a number with length 4, 5, 6
我用^ [0-9] {4}验证了数字4,但我不知道如何包含5和6的验证。
I used ^[0-9]{4} to validate for a number of 4, but I do not know how to include validation for 5 and 6.
推荐答案
试试这个:
^[0-9]{4,6}$
{4,6}
=介于4到6个字符之间。
{4,6}
= between 4 and 6 characters, inclusive.
这篇关于数字的正则表达式,长度为4,5或6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文