找回密码
 加入
搜索
查看: 5368|回复: 15

[AU3基础] 【分享、征集、请教】手机靓号正则表达式

    [复制链接]
发表于 2018-1-16 16:12:49 | 显示全部楼层 |阅读模式
本帖最后由 hnfeng 于 2018-1-16 16:16 编辑

【分享、征集、请教】手机靓号正则表达式

初学正则表达式,很手生,抱歉……

先使用正则表达式
(?<=\D)1\d{10}
从文本中提取手机号码,保存到字串中,然后再使用下面的正则。这样不需再考虑位数、前导符……等,可能会提高效率

除说明,下面的正则表达式默认是模式3。 用模式4时,取数组的0或1列。


号码的格式(或者称作样式),一个较直观的约定规则,便于理解,给普通用户看的,或者用户自定义输入指定格式用的:

ABCDEFGH 连续递增数字
   ABCD 可表示1234,2345,6789...
   ACEG 可表示1357,2468...
   ADG 可表示 147,258,369
   DCBA 可表示 4321,8765...
QRST 第二组连续递增数字
AAAA 重复数字
QQQQ 第二组重复数字
x 1个数字
* 0个或多个数字
j 1个或多个数字


请补充、请纠正下面的错误、请分享更好的正则表达式……


含一组连续递增数字组
1xxABCDEFGH
  例如:13612345678,13823456789
  正则:\b(1\d{2}(?:01234567|12345678|23456789))
1xx*ABCDEFG*
  例如:13681234567,13823456781
  正则:\b(1\d{2}\d*(?:0123456|1234567|2345678|3456789)\d*)\b
1xx*ABCDEF*
  例如:13685234567,13864567891
  正则:\b(1\d{2}\d*(?:012345|123456|234567|345678|456789)\d*)\b
1xx*ABCDE*
  例如:13685234562,13864567821
  正则:\b(1\d{2}\d*(?:01234|12345|23456|34567|45678|56789)\d*)\b
1xx*ABCD*
  例如:13685534562,13864567921
  正则:\b(1\d{2}\d*(?:0123|1234|2345|3456|4567|5678|6789)\d*)\b
1xx*ABC*
  例如:13685953452,13867442567
  正则:\b(1\d{2}\d*(?:012|123|234|345|456|567|678|789)\d*)\b
1xx*ACEG*
  例如:13685913572,13824682567
  正则:\b(1\d{2}\d*(?:0246|1357|2468|3579)\d*)\b
1xx*ADG*
  例如:13625815712,13824688369,13802585369
  正则:\b(1\d{2}\d*(?:147|258|369)\d*)\b


含一组连续递增数字组且位于尾部
1xxABCDEFGH
  例如:13612345678,13823456789
  正则:\b(1\d{2}(?:01234567|12345678|23456789))
1xxjABCDEFG
  例如:13681234567,13842345678
  正则:\b(1\d{2}\d+(?:0123456|1234567|2345678|3456789))
1xxjABCDEF
  例如:13685234567,13862123456
  正则:\b(1\d{2}\d+(?:012345|123456|234567|345678|456789))\b
1xxjABCDE
  例如:13685623456,13864156789
  正则:\b(1\d{2}\d+(?:01234|12345|23456|34567|45678|56789))\b
1xxjABCD
  例如:13685513456,13864515678
  正则:\b(1\d{2}\d+(?:0123|1234|2345|3456|4567|5678|6789))\b
1xxjABC
  例如:13685953123,13867442567
  正则:\b(1\d{2}\d+(?:012|123|234|345|456|567|678|789))\b
1xxjACEG
  例如:13685921357,13803542468
  正则:\b(1\d{2}\d+(?:0246|1357|2468|3579))\b
1xxjADG
  例如:13625612147,13824688369
  正则:\b(1\d{2}\d+(?:147|258|369))\b


含一组连续递增数字组且结束于第7位
1xxABCD*
  例如:13623454233,13856786451
  正则:\b(1\d{2}(?:0123|1234|2345|3456|4567|5678|6789)\d*)\b
1xxACEG*
  例如:13613572335,13824684322
  正则:\b(1\d{2}(?:0246|1357|2468|3579)\d*)\b
1xxxADG*
  例如:13652584417,13813698835
  正则:\b(1\d{2}\d+(?:147|258|369)\d*)\b


含两组连续递增数字组
1xxABCDQRST
  例如:13612343456,13845672345
  正则:\b(1\d{2}(?:0123|1234|2345|3456|4567|5678|6789){2})
1xxxABCxQRS
  例如:13651239456,13863457678
  正则:\b(1\d{2}\d(?:012|123|234|345|456|567|678|789)\d(?:012|123|234|345|456|567|678|789))\b
1xxABCxQRSx
  例如:13612374561,13834516782
  正则:\b(1\d{2}(?:012|123|234|345|456|567|678|789)\d(?:012|123|234|345|456|567|678|789)\d)\b
1xxjABCQRS
  例如:13647123567,13839567345
  正则:\b(1\d{2}\d{2}(?:012|123|234|345|456|567|678|789)(?:012|123|234|345|456|567|678|789))\b


不含4 (单独使用貌似没什么意思,结合其他的使用)
\b[^4]{11}\b

后8位不含4
\b1\d{2}[^4]{8}\b

后8位最少含2个8(也可把8换成其他数字)
\b(1\d{2}\d*(8)\d*\2\d*)\b  模式4
\b1\d{2}(\d*8){2}\d*\b   模式4
\b1\d{2}\d*8\d*8\d*\b

后8位最少含3个8
\b(1\d{2}\d*(8)\d*\2\d*\2\d*)\b  模式4
\b1\d{2}(\d*8){3}\d*\b   模式4
\b1\d{2}\d*8\d*8\d*8\d*\b

后8位最少含4个8
\b(1\d{2}\d*(8)\d*\2\d*\2\d*\2\d*)\b  模式4
\b1\d{2}(\d*8){4}\d*\b   模式4
\b1\d{2}\d*8\d*8\d*8\d*8\d*\b

后8位最少含5个8
\b(1\d{2}\d*(8)\d*\2\d*\2\d*\2\d*\2\d*)\b  模式4
\b1\d{2}(\d*8){5}\d*\b   模式4
\b1\d{2}\d*8\d*8\d*8\d*8\d*8\d*\b

后8位最少含6个8
\b(1\d{2}\d*(8)\d*\2\d*\2\d*\2\d*\2\d*\2\d*)\b  模式4
\b1\d{2}(\d*8){6}\d*\b   模式4
\b1\d{2}\d*8\d*8\d*8\d*8\d*8\d*8\d*\b

后8位最少含7个8
\b(1\d{2}\d*(8)\d*\2\d*\2\d*\2\d*\2\d*\2\d*\2\d*)\b  模式4
\b1\d{2}(\d*8){7}\d*\b   模式4
\b1\d{2}\d*8\d*8\d*8\d*8\d*8\d*8\d*8\d*\b

后8位是8个8
\b1\d{2}8{8}\b

含一组重复数字
1xxAAAAAAAA
  例如:13655555555,13899999999
  正则:\b(1\d{2}(\d)\2{7})\b   模式4
1xx*AAAAAAA*
  例如:13615555555,13899999991
  正则:\b(1\d{2}\d*(\d)\2{6}\d*)\b   模式4
1xx*AAAAAA*
  例如:13613555555,13829999991
  正则:\b(1\d{2}\d*(\d)\2{5}\d*)\b   模式4
1xx*AAAAA*
  例如:13613255555,13829999931
  正则:\b(1\d{2}\d*(\d)\2{4}\d*)\b   模式4
1xx*AAAA*
  例如:13613245555,13824999931
  正则:\b(1\d{2}\d*(\d)\2{3}\d*)\b   模式4
1xx*AAA*
  例如:13613242555,13824799931
  正则:\b(1\d{2}\d*(\d)\2{2}\d*)\b   模式4

含两组重复数字
1xxAAAAQQQQ
  例如:13611115555,13833339999
  正则:\b(1\d{2}(\d)\2{3}(\d)\3{3})\b   模式4
1xx*AAA*QQQ*
  例如:13611155532,13833317999
  正则:\b(1\d{2}\d*(\d)\2{2}\d*(\d)\3{2}\d*)\b   模式4
1xxxAAAxQQQ
  例如:13621114555,13853337999
  正则:\b(1\d{2}\d(\d)\2{2}\d(\d)\3{2})\b   模式4
1xxxxAAxxQQ
  例如:13626116455,13851338399
  正则:\b(1\d{2}\d{2}(\d)\2\d{2}(\d)\3)\b   模式4

递增+重复
1xxABCDABCD
  例如:13634563456,13856785678
  正则:\b(1\d{2}(0123|1234|2345|3456|4567|5678|6789)\2)\b   模式4
        \b(1\d{2}(?:0123|1234|2345|3456|4567|5678|6789)\2)\b
1xxxABCxABC
  例如:13651237123,13836781678
  正则:\b(1\d{2}\d(012|123|234|345|456|567|678|789)\d\2)\b   模式4
1xx*ABC*ABC*
  例如:13657123123,13867831678
  正则:\b(1\d{2}\d*(012|123|234|345|456|567|678|789)\d*\2)\b   模式4
1xxABABABAB
  例如:13623232323,13889898989
  正则:\b(1\d{2}(01|12|23|34|45|56|67|78|89)\2{3})\b   模式4
1xx*ABABAB*
  例如:13652323237,13838989891
  正则:\b(1\d{2}\d(01|12|23|34|45|56|67|78|89)\2{2}\d)\b   模式4
1xx*ABAB*
  例如:13657232365,13867679373
  正则:\b(1\d{2}\d*(01|12|23|34|45|56|67|78|89)\2\d*)\b   模式4
1xxxxABxxAB
  例如:13651237923,13832891389
  正则:\b(1\d{2}\d{2}(01|12|23|34|45|56|67|78|89)\d{2}\2)\b   模式4

1xxABQRABQR
  例如:13623782378,13889568956
  正则:\b(1\d{2}(01|12|23|34|45|56|67|78|89)(01|12|23|34|45|56|67|78|89)\2\3)\b   模式4
1xxABCDQRST
  例如:13612346789,13845672345
  正则:\b(1\d{2}(0123|1234|2345|3456|4567|5678|6789){2})\b   模式4
1xxQABCRABC
  例如:13615672567,13871238123
  正则:

…………

游客,如果您要查看本帖隐藏内容请回复

评分

参与人数 1金钱 +50 贡献 +1 收起 理由
afan + 50 + 1

查看全部评分

发表于 2018-1-16 16:41:37 | 显示全部楼层
你是到哪去找这些可用靓号啊
 楼主| 发表于 2018-1-16 16:53:12 | 显示全部楼层
本帖最后由 hnfeng 于 2018-1-16 17:16 编辑
你是到哪去找这些可用靓号啊
zghwelcome 发表于 2018-1-16 16:41



号码你可以去移动联通电信的网站上找啊。

今天得闲,上面这些是自己敲出来的
感觉就是苦力活啊。
应该还有一些的,不过头晕眼花的,先发上来这些。有兴趣的朋友继续……
发表于 2018-1-17 11:27:46 | 显示全部楼层
回复 1# hnfeng


   
刚入门看的我是眼花缭乱

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2018-1-17 22:38:00 | 显示全部楼层
本帖最后由 heavenm 于 2018-1-17 22:44 编辑

可是我认为
1xxxxAAxxQQ
  例如:13626116455,13851338399
这种根本不是靓号

1X973723272
1X111666754
1X111660054
1X111666454
1X617313713
1X274773447
1X111664454
1X549544994
1X229323393
1X111663354
1X111666254
1X973773370
1X973753773
1X973733991
1X373775532
1X173443743
1X111660064
1X111666174
1X374777947
1X677444227
1X080881114
1X890202902
1X773377713
1X273311001
1X773353509
1X390033039
1X390033776
1X711313118
1X211613163
1X677336605
1X373779931
1X116647472
1X373773553
1X074242724
1X115511195
1X773344611
1X973333410
1X116011610
1X373779960

这些都是我不要的号码。只有几个被我选走了
发表于 2018-1-18 02:06:20 | 显示全部楼层
本帖最后由 heavenm 于 2018-1-18 02:08 编辑

1xxABCDABCD
  例如:13634563456,13856785678
  正则:\b(1\d{2}(0123|1234|2345|3456|4567|5678|6789)\2)\b   模式4
        \b(1\d{2}(?:0123|1234|2345|3456|4567|5678|6789)\2)\b

精简:
宽松:(\d\d\d\d)\1
严格:\d{3}(\d\d\d\d)\1
发表于 2018-1-18 02:34:01 | 显示全部楼层
你提供的所有号码!
[评分][号码] 正则
[1][13612343456] (\d\d)\1
[1][13655555555] (\d\d)\1
[1][13655555555] (\d)\1(\d)\2
[2][13655555555] ^\d*(\d)\1\1(\d)\2\2\d*$
[2][13655555555] ^\d*(\d)\1{4,}\d*$
[2][13655555555] (\d\d\d)\1
[5][13655555555] \d{3}(\d\d\d\d)\1
[1][13899999999] (\d\d)\1
[1][13899999999] (\d)\1(\d)\2
[2][13899999999] ^\d*(\d)\1\1(\d)\2\2\d*$
[2][13899999999] ^\d*(\d)\1{4,}\d*$
[2][13899999999] (\d\d\d)\1
[5][13899999999] \d{3}(\d\d\d\d)\1
[1][13615555555] (\d\d)\1
[1][13615555555] (\d)\1(\d)\2
[2][13615555555] ^\d*(\d)\1\1(\d)\2\2\d*$
[2][13615555555] ^\d*(\d)\1{4,}\d*$
[2][13615555555] (\d\d\d)\1
[1][13899999991] (\d\d)\1
[1][13899999991] (\d)\1(\d)\2
[2][13899999991] ^\d*(\d)\1\1(\d)\2\2\d*$
[2][13899999991] ^\d*(\d)\1{4,}\d*$
[2][13899999991] (\d\d\d)\1
[1][13613555555] (\d\d)\1
[1][13613555555] (\d)\1(\d)\2
[2][13613555555] ^\d*(\d)\1\1(\d)\2\2\d*$
[2][13613555555] ^\d*(\d)\1{4,}\d*$
[2][13613555555] (\d\d\d)\1
[1][13829999991] (\d\d)\1
[1][13829999991] (\d)\1(\d)\2
[2][13829999991] ^\d*(\d)\1\1(\d)\2\2\d*$
[2][13829999991] ^\d*(\d)\1{4,}\d*$
[2][13829999991] (\d\d\d)\1
[1][13613255555] (\d\d)\1
[1][13613255555] (\d)\1(\d)\2
[2][13613255555] ^\d*(\d)\1{4,}\d*$
[1][13829999931] (\d\d)\1
[1][13829999931] (\d)\1(\d)\2
[2][13829999931] ^\d*(\d)\1{4,}\d*$
[1][13613245555] (\d\d)\1
[1][13613245555] (\d)\1(\d)\2
[1][13824999931] (\d\d)\1
[1][13824999931] (\d)\1(\d)\2
[1][13611115555] (\d\d)\1
[1][13611115555] (\d)\1(\d)\2
[2][13611115555] ^\d*(\d)\1\1(\d)\2\2\d*$
[1][13833339999] (\d\d)\1
[1][13833339999] (\d)\1(\d)\2
[2][13833339999] ^\d*(\d)\1\1(\d)\2\2\d*$
[1][13611155532] (\d)\1(\d)\2
[2][13611155532] ^\d*(\d)\1\1(\d)\2\2\d*$
[5][13634563456] \d{3}(\d\d\d\d)\1
[5][13856785678] \d{3}(\d\d\d\d)\1
[2][13657123123] (\d\d\d)\1
[1][13623232323] (\d\d)\1
[5][13623232323] \d{3}(\d\d\d\d)\1
[1][13889898989] (\d\d)\1
[5][13889898989] \d{3}(\d\d\d\d)\1
[1][13652323237] (\d\d)\1
[1][13838989891] (\d\d)\1
[1][13657232365] (\d\d)\1
[1][13867679373] (\d\d)\1
[5][13623782378] \d{3}(\d\d\d\d)\1
[5][13889568956] \d{3}(\d\d\d\d)\1
发表于 2018-1-18 02:38:16 | 显示全部楼层
总评分,看看有没有不太合理
[6] 13612345678
[6] 13823456789
[5] 13681234567
[6] 13823456781
[4] 13685234567
[5] 13864567891
[4] 13685234562
[5] 13864567821
[3] 13685534562
[5] 13864567921
[2] 13685953452
[2] 13867442567
[0] 13685913572
[1] 13824682567
[0] 13625815712
[0] 13824688369
[0] 13802585369
[6] 13612345678
[6] 13823456789
[5] 13681234567
[5] 13842345678
[4] 13685234567
[5] 13862123456
[4] 13685623456
[3] 13864156789
[2] 13685513456
[3] 13864515678
[1] 13685953123
[2] 13867442567
[0] 13685921357
[0] 13803542468
[4] 13625612147
[0] 13824688369
[6] 13623454233
[6] 13856786451
[0] 13613572335
[2] 13824684322
[0] 13652584417
[0] 13813698835
[7] 13612343456
[6] 13845672345
[6] 13651239456
[5] 13863457678
[6] 13612374561
[6] 13834516782
[4] 13647123567
[4] 13839567345
[20] 13655555555
[20] 13899999999
[15] 13615555555
[15] 13899999991
[10] 13613555555
[10] 13829999991
[4] 13613255555
[4] 13829999931
[6] 13613245555
[2] 13824999931
[0] 13613242555
[0] 13824799931
[11] 13611115555
[11] 13833339999
[3] 13611155532
[0] 13833317999
[3] 13621114555
[0] 13853337999
[0] 13626116455
[0] 13851338399
[11] 13634563456
[11] 13856785678
[6] 13651237123
[5] 13836781678
[7] 13657123123
[6] 13867831678
[19] 13623232323
[19] 13889898989
[7] 13652323237
[6] 13838989891
[6] 13657232365
[7] 13867679373
[6] 13651237923
[5] 13832891389
[10] 13623782378
[10] 13889568956
[6] 13612346789
[6] 13845672345
[5] 13615672567
[6] 13871238123
发表于 2018-1-18 02:42:06 | 显示全部楼层
代码!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_Res_requestedExecutionLevel=None
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <File.au3>
Dim $__file


_FileReadToArray('1.txt', $__file)
;1xxabcdabcd
For $i = 1 To $__file[0]
        $test = _FilterNumbers($__file[$i])
        FileWriteLine('test.txt', '[' & $test & '] '&$__file[$i])
Next

;~ MsgBox(0, '靓号等级', _FilterNumbers('13802585369'))
Func _FilterNumbers($__number)
        If StringIsSpace($__number) Then Return SetError(0)
        Local $__tempText, $__level, $__consecutive


        ;----含一组连续递增数字组
        $__length = StringLen($__number)
        For $__i = 1 To $__length
                If Abs(StringMid($__number, $__i, 1) - StringMid($__number, $__i - 1, 1)) == 1 Then $__consecutive += 1
                If $__consecutive >= 3 Then $__level += 1
        Next

        ;----后八位,仅由3种以内数字组成
        $__UniqueNumber = StringRegExpReplace(StringMid($__number, 4), '(\d)(?=(?:.*?\1))', '')
        If StringLen($__UniqueNumber) <= 2 Then $__level += 5 ;纯AB
        If StringLen($__UniqueNumber) <= 3 Then $__level += 2 ;纯ABC
        
        ;----各种规则筛选
        $__level += _FormatNumber($__number, '(\d\d)\1');ABAB/AAAA
        $__level += _FormatNumber($__number, '(\d)\1(\d)\2');AABB
        $__level += _FormatNumber($__number, '(\w)\1(?!\1)(\w)\2(?!\1|\2)(\w)\3', 2);AABBCC
        $__level += _FormatNumber($__number, '^\d*(\d)\1\1(\d)\2\2\d*, 2);AAABBB
        $__level += _FormatNumber($__number, '^(\d)(\d)\1\2\1\2\1\2, 2) ;ABABAB
        $__level += _FormatNumber($__number, '^(\d)(\d)(\d)\1\2\3, 2);ABCABC
        $__level += _FormatNumber($__number, '^(\d)(\d)\2\1\2\2, 2);ABBABB
        $__level += _FormatNumber($__number, '^(\d)\1(\d)\1\1\2, 2);AABAAB
        $__level += _FormatNumber($__number, '^\d*(\d)\1{4,}\d*, 2);5-8重复
        $__level += _FormatNumber($__number, '(\d\d\d)\1', 2);ABCABC
        $__level += _FormatNumber($__number, '\d{3}(\d\d\d\d)\1', 5);ABCDABCD
        Return $__level
EndFunc   ;==>_FilterNumbers


Func _FormatNumber($__str, $__regular, $__level = 1)
        Local $__debug = 1
        If StringRegExp($__str, $__regular) Then
                If $__debug == 1 Then ConsoleWrite('[' & $__level & '][' & $__str & '] ' & $__regular & @CRLF);[等级] 规则
                Return $__level
        EndIf
        Return 0
EndFunc   ;==>_FormatNumber
发表于 2018-1-18 02:48:46 | 显示全部楼层
本帖最后由 heavenm 于 2018-1-18 02:54 编辑

[7] 13867679373
这个号码按照我的标准 最高3分,BUG

我现在用的号码
1XX6767123X 不含4,感觉不是特别喜欢

主要因为我有一个比较好的号码,不过不是网上找到的,是特殊渠道
1XXABABAABB,目前网上筛选的号码,几万个,都没选到这种靓号,看来渠道很重要。网上放不出来这种靓号估计
每次报号码人家都问我是不是开玩笑!
发表于 2018-1-18 03:02:59 | 显示全部楼层
修正版,这个号码就判断一分好了
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_Res_requestedExecutionLevel=None
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <File.au3>
Dim $__file


;~ _FileReadToArray('1.txt', $__file)
;~ For $i = 1 To $__file[0]
;~         $test = _FilterNumbers($__file[$i])
;~         FileWriteLine('test.txt', '[' & $test & '] '&$__file[$i])
;~ Next

MsgBox(0, '靓号等级', _FilterNumbers('13867679373'))
Func _FilterNumbers($__number)
        If StringIsSpace($__number) Then Return SetError(0)
        Local $__tempText, $__level, $__consecutive


        ;----含一组连续递增数字组
        $__length = StringLen($__number)
        For $__i = 1 To $__length
                If StringMid($__number, $__i, 1) == StringMid($__number, $__i+2, 1) Or StringMid($__number, $__i, 1) == StringMid($__number, $__i-2, 1) Then        ContinueLoop
                If Abs(StringMid($__number, $__i, 1) - StringMid($__number, $__i - 1, 1)) == 1 Then $__consecutive += 1
                If $__consecutive >= 3 Then         $__level += 1
        Next
;~         ConsoleWrite('[' & $__level & '][' & $__number & '] 连续递增' & @CRLF);[等级] 规则

        ;----后八位,仅由3种以内数字组成
        $__UniqueNumber = StringRegExpReplace(StringMid($__number, 4), '(\d)(?=(?:.*?\1))', '')
        If StringLen($__UniqueNumber) <= 2 Then $__level += 5 ;纯AB
        If StringLen($__UniqueNumber) <= 3 Then $__level += 2 ;纯ABC
        
        ;----各种规则筛选
        $__level += _FormatNumber($__number, '(\d\d)\1');ABAB/AAAA
        $__level += _FormatNumber($__number, '(\d)\1(\d)\2');AABB
        $__level += _FormatNumber($__number, '(\w)\1(?!\1)(\w)\2(?!\1|\2)(\w)\3', 2);AABBCC
        $__level += _FormatNumber($__number, '^\d*(\d)\1\1(\d)\2\2\d*, 2);AAABBB
        $__level += _FormatNumber($__number, '^(\d)(\d)\1\2\1\2\1\2, 2) ;ABABAB
        $__level += _FormatNumber($__number, '^(\d)(\d)(\d)\1\2\3, 2);ABCABC
        $__level += _FormatNumber($__number, '^(\d)(\d)\2\1\2\2, 2);ABBABB
        $__level += _FormatNumber($__number, '^(\d)\1(\d)\1\1\2, 2);AABAAB
        $__level += _FormatNumber($__number, '^\d*(\d)\1{4,}\d*, 2);5-8重复
        $__level += _FormatNumber($__number, '(\d\d\d)\1', 2);ABCABC
        $__level += _FormatNumber($__number, '\d{3}(\d\d\d\d)\1', 5);ABCDABCD
        Return $__level
EndFunc   ;==>_FilterNumbers


Func _FormatNumber($__str, $__regular, $__level = 1)
        Local $__debug = 1
        If StringRegExp($__str, $__regular) Then
                If $__debug == 1 Then ConsoleWrite('[' & $__level & '][' & $__str & '] ' & $__regular & @CRLF);[等级] 规则
                Return $__level
        EndIf
        Return 0
EndFunc   ;==>_FormatNumber
发表于 2018-1-18 03:05:27 | 显示全部楼层
本帖最后由 heavenm 于 2018-1-18 03:32 编辑

这个连号规则好复杂啊!
N多BUG
发表于 2018-1-18 03:53:45 | 显示全部楼层
连续递增的修正了,这下应该什么问题了
        $__length = StringLen($__number)
        For $__i = 1 To $__length
                If StringMid($__number, $__i, 1) == StringMid($__number, $__i + 2, 1) Or StringMid($__number, $__i, 1) == StringMid($__number, $__i - 2, 1) Then ContinueLoop
                $__diff = StringMid($__number, $__i, 1) - StringMid($__number, $__i - 1, 1);与下一位数字差异值
                If Abs($__diff) == 1 Then $__consecutive += $__diff
                If $__consecutive >= 3 Then
                        $__level += 1
                        If Abs($__consecutive + 1) <> Abs($__consecutive + $__diff) Then
                                $__consecutive = 0
                        EndIf
                EndIf
        Next
这个连续递增这么复杂,写完,我自己也迷糊了
发表于 2018-1-18 04:24:29 | 显示全部楼层
不改了!脑壳疼!~~~
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_Res_requestedExecutionLevel=None
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <File.au3>
Dim $__file


;~ _FileReadToArray('1.txt', $__file)
;~ For $i = 1 To $__file[0]
;~         $test = _FilterNumbers($__file[$i])
;~         FileWriteLine('test.txt', '[' & $test & '] '&$__file[$i])
;~ Next

MsgBox(0, '靓号等级', _FilterNumbers('13867679373'))
Func _FilterNumbers($__number)
        If StringIsSpace($__number) Then Return SetError(0)
        Local $__tempText, $__level, $__consecutive, $__diff


        ;----含一组连续递增数字组
        $__length = StringLen($__number);数字长度
        For $__i = 1 To $__length
                If $__i == 1 Then ContinueLoop
                $__diff = StringMid($__number, $__i, 1) - StringMid($__number, $__i - 1, 1);与下一位数字差异值
                If Abs($__diff) == 1 Then
;~                         MsgBox(0, $__i, StringMid($__number, $__i, 1) & '-' & StringMid($__number, $__i - 1, 1))
                        $__consecutive += $__diff;如果差距为1则增加连续数

                        
                        If $__consecutive >= 2 Then;连续2次等于三连
;~                                 MsgBox(0, $__i, StringMid($__number, $__i, 1) & '-' & StringMid($__number, $__i - 1, 1))
                                $__level += 1
                                If Abs($__consecutive + 1) <> Abs($__consecutive + $__diff) Then;防止出现正逆,两种混合数字误判,如6767
                                        
                                        $__consecutive = 0
                                EndIf
                        EndIf
                EndIf
        Next
        ConsoleWrite('[' & $__level & '][' & $__number & '] 连续递增' & @CRLF);[等级] 规则

        ;----后八位,仅由3种以内数字组成
        $__UniqueNumber = StringRegExpReplace(StringMid($__number, 4), '(\d)(?=(?:.*?\1))', '')
        If StringLen($__UniqueNumber) <= 2 Then $__level += 5 ;纯AB
        If StringLen($__UniqueNumber) <= 3 Then $__level += 2 ;纯ABC
        
        ;----各种规则筛选
        $__level += _FormatNumber($__number, '(\d\d)\1');ABAB/AAAA
        $__level += _FormatNumber($__number, '(\d)\1(\d)\2');AABB
        $__level += _FormatNumber($__number, '(\w)\1(?!\1)(\w)\2(?!\1|\2)(\w)\3', 2);AABBCC
        $__level += _FormatNumber($__number, '^\d*(\d)\1\1(\d)\2\2\d*, 2);AAABBB
        $__level += _FormatNumber($__number, '^(\d)(\d)\1\2\1\2\1\2, 2) ;ABABAB
        $__level += _FormatNumber($__number, '^(\d)(\d)(\d)\1\2\3, 2);ABCABC
        $__level += _FormatNumber($__number, '^(\d)(\d)\2\1\2\2, 2);ABBABB
        $__level += _FormatNumber($__number, '^(\d)\1(\d)\1\1\2, 2);AABAAB
        $__level += _FormatNumber($__number, '^\d*(\d)\1{4,}\d*, 2);5-8重复
        $__level += _FormatNumber($__number, '(\d\d\d)\1', 2);ABCABC
        $__level += _FormatNumber($__number, '\d{3}(\d\d\d\d)\1', 5);ABCDABCD
        Return $__level
EndFunc   ;==>_FilterNumbers


Func _FormatNumber($__str, $__regular, $__level = 1)
        Local $__debug = 1
        If StringRegExp($__str, $__regular) Then
                If $__debug == 1 Then ConsoleWrite('[' & $__level & '][' & $__str & '] ' & $__regular & @CRLF);[等级] 规则
                Return $__level
        EndIf
        Return 0
EndFunc   ;==>_FormatNumber

评分

参与人数 1金钱 +10 收起 理由
zpmc123 + 10 赞一个

查看全部评分

 楼主| 发表于 2018-1-18 08:54:05 | 显示全部楼层
回复 14# heavenm


    赞一个
好高深啊
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-24 07:31 , Processed in 0.087022 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表