This function helped me to build @boiler and @mikeyww. Many thanks for help and support.
I have updated this function and I think I am almost finished with this part.
Function works and does what I need, but I just wondering if you could help me simplify function or make more dynamic if possible or maybe just give me notes/comments where could be problem in the future.
The goal is to find in the string numbers which are made from 7 digits, string - FORNYELSECODE and single digit. So all single digits of 7 or with additional strings Fornyelsecode and single digit is good. single digits will be validated later.
Just idea:
I thought I would use RegExReplace, but I could not manage to write syntax which could clear "Polisenr Modul Selskap", any doubledigits, string "HAR". I thought it will move every part of string to the left position, it means if we have 08 9911118 00 HAR FORNYELSECODE 3 after replacement will be 9911118 FORNYELSECODE 3 and 7 digits from m2 will move to m1 and so on, and I will have clear positions which I can manipulate. But this was just idea. did not had chance to check.
Code: Select all
^!e::
str =
(
Polisenr Modul Selskap
1234567 06 07
08 9911118 00 HAR FORNYELSECODE 3
Polisenr Modul Selskap
2345678
09 7654321 00 HAR FORNYELSECODE 7
04 1122334 00 HAR FORNYELSECODE 8
0125878
)
loop, Parse, str, `n, `r
{
RegExMatch(A_LoopField, "\s*(\w+)*\s*(\w+)*\s*(\w+)*\s*(\w+)*\s*(\w+)*\s*(\w+)*", m)
if (m1 = "Polisenr" AND m2 = "Modul" AND m3 = "Selskap") {
continue
}
if (m1 = 08 OR m1 = 09 OR m1 = 04) {
m1 = %m2%
MsgBox, %m1% %m5% %m6%; example: 9911118 FORNYELSECODE 3 or 0125878
if(m6 = 8 OR m6 = 7 OR m6 = 3){
MsgBox, % m6
}
}
;~ MsgBox, % "part 1: " m1 "`npart 2: " m2 "`npart 3: " m3 "`npart 4: " m4 "`npart 5: " m5 "`npart 6: " m6
}
return