Code:
alias example_mid {
  var %string = 6f1ed002ab5595859014ebf0951522d9
  var %b = 1, %n = 1
  while ($mid(%string,%b,8) != $null) {

    ; $v1 is the current chunk, e.g.:
    set -l $+(%,chunk.,%n) $v1

    inc %b 8
    inc %n
  }

  ; - do stuff with %chunk.1 to %chunk.4 -
}


alias example_regex {
  var %string = 6f1ed002ab5595859014ebf0951522d9
  noop $regex(example,%string,/(.{8})/g)

  ; $regml(example,N) is now filled with your chunks

  var %n = 1
  while ($regml(example,%n) != $null) {
    echo -a chunk %n is: $v1
    inc %n
  }
}


Last edited by Horstl; 09/10/09 10:50 AM.