[AHK]正则表达式提取匹配的多个内容

提问:如何提取表达式14 *(2+3)+5中的数字和运算符?

 

在网站 https://regexper.com  测试 \d+|\+|\-|\*|\/|\(|\) 可以正确匹配数字和运算符

[AHK]正则表达式提取匹配的多个内容_第1张图片

 

Haystack:="14 *(2+3)+5"
NeedleRegEx:="O)(\d+|\+|\-|\*|\/|\(|\))"
Match := {Len: {0: 0}},  FoundPos := 1
While (FoundPos := RegExMatch(Haystack, NeedleRegEx, Match, FoundPos + Match.Len[0]))
   OutputDebug % Match.Value(0)

输出如下:

[AHK]正则表达式提取匹配的多个内容_第2张图片

你可能感兴趣的:(AutoHotkey,正则表达式,算法)