```per your code:

> str = 'a<b>[c]{d}"e"f {{g}} [[h]]*i**j*"k"'
>
> s = ['<','[','{','"','*']
> e = ['>',']','}','"','*']
> arr = []
>
> str.gsub!(' ','')
> i = 0
> while i< str.length
>
>   if not s.include?(str[i,1])
>         for j in i ... str.length
>           if s.include?(str[j,1])
>             arr << str[i..j-1]
>             i = j
>             break
>           end
>         end
>   end
>
>   for j in 0 ... s.length
>     if str[i,1] == s[j]
>       if s[j]=='"' || s[j]=='*'
>         k = str.index(e[j],i+1)
>       else
>         k = i
>         k += 1 while str[k,1]==s[j]
>
>         for k in str.index(e[j],k) ... str.length
>           if str[k,1]!=e[j]
>             k -= 1
>             break
>           end
>         end
>       end
>       arr << str[i..k]
>       i = k+1
>       break
>     end
>   end
>
> end

very impressive. i especially like the lack of regexp.
i only had to make two small changes to get it to work just right:
removed str.gsub!(' ','')
and changed arr << str[i..j-1] to arr << str[i..j-1].strip

it still has one problem though. it falls into an infinite loop
if the last part of the string isn't contained by any tokens.
for example if an l is added:
str = 'a<b>[c]{d}"e"f {{g}} [[h]]*i**j*"k"l'
i'm sure this could be easily fixed.

did you take a look at sean's version, by the way?
a tad more elegent although he does use regexps.

i managed to get my own code to work and down to about 60 lines,
but it's still little league compared to yours and sean's examples.
mine was sort of a cross between yours and seans actually, but using big old
case statement.

i decided to use the faster of the three. i thought it would be yours
for the lack of the regexp, but suprisingly sean's edges out. (mine was last)
ruby's regexp implementation must be quite "crisp".

anyway, thanks Park. your code was quite helpful and interesting to study.

~transami

```