For instance, I have a similar block of text like so:
@text = “Lorem ipsum
[some code here]dolor sit”
What sytax would I use to check if the text is in between the
tags?
That is: “If @text is in between ‘’ and ‘’ tags, then
do…”
Any ideas?
For instance, I have a similar block of text like so:
@text = “Lorem ipsum
[some code here]dolor sit”
What sytax would I use to check if the text is in between the
tags?
That is: “If @text is in between ‘’ and ‘’ tags, then
do…”
Any ideas?
Maybe you could look at regular expressions.
Mickael.
On Aug 15, 10:27 pm, Bob S. [email protected]
Bob S. wrote:
do…"
Any ideas?
This regex pattern seems to work
/(.*?)</code>/
extracting the string now is a bit more difficult
– jarod
Bob S. wrote:
Any ideas?
REXML::Document.new(‘’ + my_string + ')
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.
–
Phlip
http://www.oreilly.com/catalog/9780596510657/
“Test Driven Ajax (on Rails)”
assert_xpath, assert_javascript, & assert_ajax
If this can / is being done in rjs or javascript, then Prototype has
methods that can do this. http://prototypejs.org
Jarod R. wrote:
tags?
extracting the string now is a bit more difficult
– jarod
–
Sincerely,
William P.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs