Code: Select all
test := RegExMatches("12_567", "\d+")
Msgbox % test[1] "," test[2] ; --> 12,567
test := RegExMatches("12_567", "\d(\d+)", 1) ; 取得子匹配 1 的结果
Msgbox % test[1] "," test[2] ; --> 2,67
RegExMatches(ByRef Haystack, NeedleRegEx, SubPat:="")
{
arr := [], startPos := 1
while ( pos := RegExMatch(Haystack, NeedleRegEx, match, startPos) )
{
arr.push(match%SubPat%)
startPos := pos + StrLen(match)
}
return arr.MaxIndex() ? arr : ""
}