Find and replace in ruby+rails, including tags -


I have a list of the words that I'm matching against the displayed string. In the stars, matching words can be found on their own & lt; B & gt; should be placed in the tag

First of all, the best way to find gsub is to place it in Ruby? I do not need full RJX power, just by matching.

Second, am I trying to insert any tag as a string in the displayed content? How do i do this

I think you are looking for:

  Highlight ( 'You searched: Rail', 'Rail') # = & gt; You searched for: & lt; Strong class = "highlight" & gt; Rail & lt; / Strong>   

See links for more options.

Comments