#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