Hi.
I store the content of a website in a string $html.
I want to count all html links that link to a file in the .otf format, add a list of these links to the end of $html and remove the original links.
An example:
<?php
$html_input = '
<p>
Lorem <a href="font-1.otf">ipsum</a> dolor sit amet,
consectetur <a href="http://www.cnn.com">adipiscing</a> elit.
Quisque <a href="font-2.otf">ultricies</a> placerat massa
vel dictum.
</p>'
// some magic here
$html_output = '
<p>
Lorem ipsum dolor sit amet,
consectetur <a href="http://www.cnn.com">adipiscing</a> elit.
Quisque ultricies placerat massa
vel dictum.
</p>
<p>.otf-links: 2</p>
<ul>
<li><a href="font-1.otf">ipsum</a></li>
<li><a href="font-2.otf">ultricies</a></li>
</ul>'
?>
How do I do that? Should I use regular expressions, or is there another way?