re = /<li>([a-zA-Z]+)<br \/>([a-zA-Z]+)<\/li>/m
str = '<div class=\'post-header\'>
<div class=\'post-header-line-1\'></div>
</div>
<div class=\'post-body entry-content\' id=\'post-body-210098160524748093\' itemprop=\'articleBody\'>
<div class="separator" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em; text-align: center;">
<br /></div>
<br />
<br />
<ul>
<li>Name<br />Location</li>
<li>Name<br />location</li>
<li>name<br />location</li>
<li>name<br />location</li>
</ul>
<br />
'
# 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