Тема: AHK: Позиция в While
Добрый день. Как правильно обозначить позицию "Pos", чтобы обрабатывались все соответствия, идущие подряд? По какой-то причине, содержимое <relative>(.*?)</relative> — обрабатывается через один раз.
#SingleInstance Force
fBody =
(
<user>
<relatives list="true">
<relative>
<id>-462658649</id>
<type>sibling</type>
<name>Наталья Маслова</name>
</relative>
<relative>
<id>-697067159</id>
<type>sibling</type>
<name>Оксана Антонова</name>
</relative>
<relative>
<id>-783504179</id>
<type>child</type>
<name>Данил</name>
</relative>
<relative>
<id>-841638376</id>
<type>child</type>
<name>Максим</name>
</relative>
</relatives>
</user>
)
match := "", Pos := 1
While Pos := RegExMatch(fBody, "s)<user>(.*?)</user>\R",match,Pos+StrLen(match))
{
matcdh := "", Pos := 1
While Pos := RegExMatch(match1, "s)<relative>(.*?)</relative>",matcdh,Pos+StrLen(matcdh))
{
matcdh1 := RegExReplace(matcdh1, "(\R|</[^>]*>)", "")
matcdh1 := RegExReplace(matcdh1, "<([^>]*)>", "|$1: ")
StringReplace, match1, match1, %matcdh%, %matcdh1%, All
}
msgbox % match1
}