From: "John W. Long" Date: 2004-01-11T15:54:54+09:00 Subject: Re: Converting a string to an array of tokens This is quick and dirty, but it demonstrates what I am looking for: tokens = %w{ <body> <p>

} string = <<-HERE test

wow it worked

HERE class String def tokenize(tokens) tokens.each { |t| self.gsub!(/#{t}/, "<>#{t}<>") } self.gsub!(/\A<>/, '') split('<>') end end p string.tokenize(tokens)
this should output: ["", "\n ", "", "\n ", "", "test", "", "\n ", "", "\n ", "", "\n ", "

", "wow it worked", "

", "\n ", "", "\n", "", "\n"] Is there a better way? ___________________ John Long www.wiseheartdesign.com