# 正则表达式实现匹配连续数字的方法

• • 1、纯数字
2、5-7位之间
3、前三位相同
4、从第四位开始连续

11123    #正确
22234    #正确
33345    #正确
333456   #正确
2223456   #正确
0001234   #正确
00012345  #错误：此行长度超标
000234   #错误：第3位与第4位不连续
111235   #错误：第5位和第6位不连续
1、匹配三位相同数字
(\d)\1{2}
2、匹配连续数字

(0(?=1)|1(?=2)|2(?=3)|3(?=4)|4(?=5)|5(?=6)|6(?=7)|7(?=8)|8(?=9)){2}\d
\d((?<=0)1|(?<=1)2|(?<=2)3|(?<=3)4|(?<=4)5|(?<=5)6|(?<=6)7|(?<=7)8|(?<=8)9){2}

^(\d)\1{2}((?<=(0(?=1)|1(?=2)|2(?=3)|3(?=4)|4(?=5)|5(?=6)|6(?=7)|7(?=8)|8(?=9)))\d){2,4}\$
^(\d)\1{2}((?<=0)1|(?<=1)2|(?<=2)3|(?<=3)4|(?<=4)5|(?<=5)6|(?<=6)7|(?<=7)8|(?<=8)9){2,4}\$
{"ft_lang_label":"__label__zh","ft_lang_prob":0.7132537,"math_prob":0.9999833,"size":1360,"snap":"2020-24-2020-29","text_gpt3_token_len":1059,"char_repetition_ratio":0.12831858,"word_repetition_ratio":0.0,"special_character_ratio":0.5147059,"punctuation_ratio":0.1598513,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99898744,"pos_list":[0,1,2,3,4,5,6,7,8],"im_url_duplicate_count":[null,3,null,3,null,3,null,3,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-06-07T07:08:27Z\",\"WARC-Record-ID\":\"<urn:uuid:8376d6bb-f08d-4dc0-b2ff-7bf9cfeaed4c>\",\"Content-Length\":\"18639\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:04872273-b5b4-4382-a565-cef601cf008d>\",\"WARC-Concurrent-To\":\"<urn:uuid:f8c2697e-5464-4859-bdce-410da5309fde>\",\"WARC-IP-Address\":\"156.225.135.62\",\"WARC-Target-URI\":\"http://www.intnet.net/wangluobiancheng/zhengzebiaodashi/181.html\",\"WARC-Payload-Digest\":\"sha1:D3DF273OBOMN5VWTRURKLTHTJJW2FTUK\",\"WARC-Block-Digest\":\"sha1:6FKB7UYGAO525GLWULGGLL7RVJFGDS6C\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-24/CC-MAIN-2020-24_segments_1590348523564.99_warc_CC-MAIN-20200607044626-20200607074626-00596.warc.gz\"}"}