How to grep all lines within the body
tag using ruby
? I know this can be solved with Nokogiri
but I want to learn how to do it.
Example:
<body>
<h1>Hello world</h1>
<div>
<button>Submit</button>
</div>
</body>
From the above example, I want all the lines within the body
tag, which is h1
, div
, and button
element.
File path link: "#{Rails.root}/app/templates/example.html"