Help with regex and <p> tag

Hi,

I need to create a regex to extract 4 paragraphs of a text:

Topic – abc

abcd

abcde

abcdef

abcdefg

I need to extract 4 paragraphs (text inside

including some html
code) of this text using a regex.

How can I solve this problem ? I’ve tried a lot but I cant do this.

Thanks in advance.

On Friday, February 28, 2014 1:31:30 PM UTC, Guilherme wrote:

The standard advice would be to not use regular expressions - use an
html
parser like nokogiri.

Fred

Yes sir.
Thanks for the tip.
This code makes the magic:

  doc = Nokogiri::HTML("<p>test</p>")
  doc.search("p")

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