From: Park Heesob Date: 2002-07-04T15:54:52+09:00 Subject: Re: the pains of parsing Hi, "Tom Sawyer" wrote in message news:1025760825.2466.193.camel@silver... > per your code: > .... > > 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[c]{d}"e"f {{g}} [[h]]*i**j*"k"l' > i'm sure this could be easily fixed. > Here is my second version: ------------------------------------------------------------------- str = 'ad3[c]{d}"e"f {{g}} [[h]]*i**j*"k"ll"sdfsd"z' s = ['<','[','{','"','*'] e = ['>',']','}','"','*'] arr = [] i = 0 while i< str.length if not s.include?(str[i,1]) j = i+1 j += 1 while j 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[c]{d}"e"f {{g}} [[h]]*i**j*"k"l' > ~transami > Park Heesob.