I want to use Ruby (maybe its File class) to grab/change certain content in a html file. For example:
<html>
<script>
...
</script>
<!-- example -->
<div class="1">
<div class="2">
....
<p>...</p>
</div>
...
</html>
So can I use ruby to run through all the htmls in the folder and change all the html's content to include only <!-- example -->.*?<\/div>
in each file?
NOTE:wants to add more clarification: not just copy the text, but the code too. I may grab the code content from <!-- example --> to <\/div>
Thank you and I'm looking forward to your reply!