str = "one^|uno||three^^^^|four^^^|^cuatro|" sep = "|" esc = "^" put tokenize(str, sep, esc) -- ["one|uno", "", "three^^", "four^|cuatro", ""]