Home  >  Article  >  Backend Development  >  How to match increasing numbers with regular expression

How to match increasing numbers with regular expression

PHP中文网
PHP中文网Original
2017-03-30 11:04:005547browse

正则表达式如何匹配递增数字 :

正则表达式如何匹配6位数为这种数字格式?
123123
234234
345345

1、

/^(123|234|345|456|678|789)\1$/g

2、

var aabbcc = /^(?:(\d)\1)+$/;
var ababab = /(\d{2})\1+$/;
var abcabc = /^(\d{3})\1+$/;
var aaabbb = /^(?:(\d)\1\1)+$/;

以上就是正则表达式如何匹配递增数字 的内容,更多相关内容请关注PHP中文网(www.php.cn)!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn