re = /<p>DETAILS[\s\S]*|(<p>.*?<\/p>)|.*/
str = '<info>
<owner>
<p>Owners:</p>
<p>1. New Owner_1</p>
<p>2. New Owner_2</p>
</owner>
<addons>
<p>Name of dog: Alex</p>
<p>1. Text blah blah blah</p>
<p>2. Text blah blah blah</p>
<p>3. Text blah blah blah</p>
<p>4. Text blah blah blah</p>
<p>OR MORE Text blah blah blah</p>
</addons>
<p>DETAILS</p>
<p>1. Vicky Mears 1st dog\'s owner.</p>
<p>2. Paul Nash 2nd dog\'s owner.</p>
<p>3. Dog found last Apr. 2016</p>
</info>'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html