- local integer l_iCount l_i l_iOpen l_iQuot\r
- local string l_sChar l_sLast l_sNext l_sBuf\r
- \r
- move 0 to l_iCount\r
- move 0 to l_iOpen\r
- move 0 to l_iQuot\r
- move "" to l_sLast\r
- for l_i from 0 to (length(argv))\r
- move (mid(argv,1,l_i)) to l_sChar\r
- move (mid(argv,1,l_i-1)) to l_sLast\r
- \r
- if ((l_sChar = '{') and (l_sLast <> '\')) increment l_iCount \r
- if (l_iCount <> argv2) break begin\r
+ local integer l_iCount l_i\r
+ local string l_sChar l_sLast l_sReturn\r
+ \r
+ move "" to l_sChar\r
+ move "" to l_sLast\r
+ move "" to l_sReturn\r
+ for l_i from 0 to (length(argv))\r
+ move (mid(argv,1,l_i)) to l_sChar\r
+ move (mid(argv,1,l_i-1)) to l_sLast\r
+ if ((l_sChar = '{') and (l_sLast <> '\')) increment l_iCount \r
+ if ((l_sChar = '}') and (l_sLast <> '\') and (l_iCount = argv2)) break\r
+ if (((l_sChar = '{') and (l_sLast <> '\')) or (l_iCount < argv2)) break begin\r
+ \r
+ append l_sReturn l_sChar\r
+ loop\r
+ \r
+ function_return l_sReturn\r
+end_function\r
+\r
+// Parse an output string from regexp_matches to get the result at an index\r
+// stripping out all escaping.\r
+// E.g\r
+// move (regexp_matches_item_stripped(myRegexMatchesOutput,muInt)) to myString\r
+function regexp_matches_item_stripped global string argv integer argv2 returns string\r
+ local integer l_iCount l_i l_iOpen l_iQuot\r
+ local string l_sChar l_sLast l_sNext l_sBuf\r
+ \r
+ move 0 to l_iCount\r
+ move 0 to l_iOpen\r
+ move 0 to l_iQuot\r
+ move "" to l_sLast\r
+ for l_i from 0 to (length(argv))\r
+ move (mid(argv,1,l_i)) to l_sChar\r
+ move (mid(argv,1,l_i-1)) to l_sLast\r
+ \r
+ if ((l_sChar = '{') and (l_sLast <> '\')) increment l_iCount \r
+ if (l_iCount <> argv2) break begin\r