我需要验证增值税号码。
xxxx.xxx.xxx --> 0123.456.789是一个有效的数字。
我发现了一个正则表达式
^(BE)[0-1]{1}[0-9]{9}$|^((BE)|(BE ))[0-1]{1}(\d{3})([.]{1})(\d{3})([.]{1})(\d{3})这将验证以下条目: BE 0123.456.789。
但是我需要的是只验证xxxx.xxx.xxx (其他的都是有效的,只有这个)
所以4个数字,一个点,3个数字,一个点,3个数字。
它还需要从0或1开始(第一个x --> 0或1)
发布于 2011-05-05 04:18:54
这应该是可行的:
^[01]\d{3}\.\d{3}\.\d{3}$发布于 2011-05-05 04:17:52
这就是了:
^[01]\d{3}\.\d{3}\.\d{3}$细目:
^ - Start of string
[01] - Followed by a 0 or 1
\d{3} - Followed by three numerals
\. - Followed by a .
\d{3} - Followed by three numerals
\. - Followed by a .
\d{3} - Followed by three numerals
$ - Followed by end of string发布于 2011-05-05 04:17:36
这是表达式
^[0-1]\d{3}[.]\d{3}[.]\d{3}$
^ // start of the input
\d{#} // numbers repeated # times
[.] // literal . (same as \. )
$ // end of the inputhttps://stackoverflow.com/questions/5889310
复制相似问题