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

How to match increasing numbers with regular expression

PHP中文网
Release: 2023-03-01 08:06:02
Original
5637 people have browsed it

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

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

1、

1

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

Copy after login

2、

1

2

3

4

var aabbcc = /^(?:(\d)\1)+$/;

var ababab = /(\d{2})\1+$/;

var abcabc = /^(\d{3})\1+$/;

var aaabbb = /^(?:(\d)\1\1)+$/;

Copy after login

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

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template