How to Extract certain Strings from an existing String?
807606Jun 5 2007 — edited Jun 6 2007I have a program which is reading text from files and marking certain words with <span> tags. I then display them in a JSP page. My issue is that the text from a file may contain HTML tags that I want the browser to render as text and not analyze them, but my <span> tags have to be rendered properly.
I was thinking that in some way I should split up the String into sections based on any tag matching <span ...> (I have specific information in those tags) and all the other parts maybe replace < with < and > with %gt;
So for example if I have
Today was a rainy <span type="dayofweek" id="1">Friday</span>.
I'd like an array of Strings
"Today was a rainy"
"<span type="dayofweek" id="1">"
"Friday"
"</span>"
Is there some type of tokenizing method that I can use to get this type of result?