Park Heesob wrote: >> did you take a look at sean's version, by the way? >> a tad more elegent although he does use regexps. >> > Sean's version fails at > str = 'a<b>[c]{d}"e"f {{g}} [[h]]*i**j*"k"l' Adding two characters to the regexp fixes that. The regexp should be string =~ /(.*?)(?=[<[{"*']|$)/ -- |.. "They that can give up essential liberty to obtain a little <|> temporary safety deserve neither liberty nor safety." /|\ -- Benjamin Franklin /| |