I think, the easiest way is with 'tokenat'. If you have more complex command you have to use Regex.
from the manual:
"tokenat(src, index, separator)
Return the Nth token from src, splitting the string by separator. For example, tokenat("apples|oranges|bananas", 1, "|") returns oranges."
I made a little example with tokenat:
the commands are: left, right, up, down, and the amount of pixels to move.
left 50 for example