Help on extracting data from string

Hi,

Has anyone got any suggestions on the bes way to solve perform this, I
have tried using HTMLTokenizer but had no luck.

I have a string which will have an unlimited amounts of

ruby
stuff here
in it, I want to be able to get the text inside
these two tags and run formatt function on them.

Any suggestions on the best way to do this?

thanks
josh

josh wrote:

I have a string which will have an unlimited amounts of

ruby
stuff here
in it, I want to be able to get the text inside
these two tags and run formatt function on them.

Any suggestions on the best way to do this?

thanks
josh

How about using the sub/gsub method?

string.sub(Regexp.escape(

), ‘’).gsub
%r(#{Regexp.escape(
)}$), ‘’

josh wrote:

I want to be able to get the text inside
these two tags and run formatt function on them.
maybe you want this:
http://atomgiant.com/2006/08/01/coderay-syntax-highlighting-for-typo/

I’ve used Hpricot successfully for parsing HTML. It’s a quality gem.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs