Ruby on Rails Friday, February 28, 2014

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

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

On Friday, February 28, 2014 11:07:53 AM UTC-3, Frederick Cheung wrote:


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

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

<p>
<b>Topic </b>–
abc
</p>


<p>abcd</p>
<p>abcde</p>
<p>abcdef</p>
<p>abcdefg</p>


I need to extract 4 paragraphs (text inside <p></p> 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.


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

Fred
 
Thanks in advance.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3702a54f-87d9-41b3-9bf1-a5791a431e69%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment