Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/433.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
正则表达式能否区分JavaScript中包含每个子句长度恒定数的字符串?_Javascript_Regex - Fatal编程技术网

正则表达式能否区分JavaScript中包含每个子句长度恒定数的字符串?

正则表达式能否区分JavaScript中包含每个子句长度恒定数的字符串?,javascript,regex,Javascript,Regex,对不起,我的英语很差。以下是一些例子: '000,111,123,486' //true '000' //true '000,111,123,486,781' //true '000,111,123,486,781,471' //true '868,1,662' //false because the length of the second clause is 1. '000,' //false because there is only 1 clause so the comma is no

对不起,我的英语很差。以下是一些例子:

'000,111,123,486' //true
'000' //true
'000,111,123,486,781' //true
'000,111,123,486,781,471' //true
'868,1,662' //false because the length of the second clause is 1.
'000,' //false because there is only 1 clause so the comma is not allowed.
我需要一个正则表达式来匹配这个模式。谢谢。

我自己解决了

/^(\d{3})(,\d{3})*$/