I'd like to split the content of a text variable in a dictionary. The content is a sequence of rows with format key = value.
Owner = [email protected] \r\n Validator = [email protected] \r\n Approver = [email protected] \r\n
Thank you for your help. Salvatore
You can Try:
♥text = ⊂"Owner = [email protected]\r\nOwner2 = [email protected]"⊃
text.find text ♥text regex ‴(?<keys>.*)=(?<values>.*)‴
for ♥i from 1 to ♥keys⟦count⟧
if ⊂♥i == 1⊃
♥dict = ⟦dictionary⟧♥keys⟦♥i⟧❚♥values⟦♥i⟧
else
♥dict⟦♥keys⟦♥i⟧⟧ = ♥values⟦♥i⟧
end if
end for
dialog ♥dict⟦owner⟧