How do you check if text is in between certain <tags>?

Maybe you could look at regular expressions.

Bob Sanders wrote:

For instance, I have a similar block of text like so:

> @text = "Lorem ipsum <code>[some code here]</code> dolor sit"

What sytax would I use to check if the text is in between the <code>

That is: "If @text is in between '<code>' and '</code>' tags, then

Any ideas?'<xml>' + my_string + </xml>')

if 'my target' == REXML::XPath.first('/xml/code/').text

Test side, you bottle that up in assert_xpath (or assert_hpricot;).

Not sure why you need it production-side, and that influences the syntax. If the whole string comes from the user, you need to tolerate faults, and the equivalent Hpricot might work better.

And if the string comes from the user, and you don't want to abuse them and XML at the same time, you could try YAML.