On Sat, 02 Feb 2008 17:14:26 -0500, Chris Hickman wrote:

> Corey Haines wrote:
>> but if you can describe why you want to do it, there might be a
>> different way
> 
> It is kind of hard to explain but I have a long string that someone
> typed into a form which was then saved into a database.  They used made
> up tags such as "<choose1>, </choose1>, <row>, </row>, <tbl> ..."  I
> have to translate the string into html and add javascript etc. based on
> the different tags they wrote.
> 
> I have it working for everything except one task.  In this one task I
> want to pass the words between two tags as a value for the javascript.
> The problem is it is pulling the phrase apart at every space.  I know I
> can add .each(???) and have it pull everything apart at the ??? but it
> would involve a lot of adding ??? to this long string.
> 
> What I am trying to do is add a while loop inside the block that will
> look ahead at the next substring to see if it is a "</choose1>".  If it
> is I want it to exit the while loop and go on without throwing away the
> "</choose1>" tag because it is needed next time through the block.
> 
> Sorry if that didnt make sense at all.

Might I suggest that using REXML (or another XML parser) may make more 
sense for what you're trying to do? First navigate your way through the 
tag structure, then you can get the text elements that you're trying to 
find.



-- 
Ken (Chanoch) Bloom. PhD candidate. Linguistic Cognition Laboratory.
Department of Computer Science. Illinois Institute of Technology.
http://www.iit.edu/~kbloom1/