I have an obvious hyperlink which I all want to replace in a text to just normal HTML hyperlinks. So this just works for one hyperlink:
$string = '<u>\\n\\\\*HYPERLINK \\"http://www.youtube.com/watch?v=A0VUsoeT9aM\\"A Youtube Video</u>';
$pattern = '/http[?.:=\\w\\d\\/]*/';
$namePattern = '/(?:")([\\s\\w]*)</';
preg_match($pattern, $string, $matches);
preg_match($namePattern, $string, $nameMatches);
echo '<a href="'.$matches[0].'">'.$nameMatches[1].'</a>';
But there are more hyperlinks than just one in a text so I want to just change all of these hyperlinks:
<?php
$input = 'Blablabla Beginning Text <u>\\n\\\\*HYPERLINK \\"http://www.youtube.com/watch?v=A0VUsoeT9aM\\"1.A Youtube Video</u> blablabla Text Middle <u>\\n\\\\*HYPERLINK \\"http://www.youtube.com/watch?v=A0VUsoeT9aM\\"2. A Youtube Video</u> blabla Text after';
//To become:
$output = 'Blablabla Beginning Text <a href="http://www.youtube.com/watch?v=A0VUsoeT9aM">1. A Youtube Video</a>blablabla Text Middle <a href="http://www.youtube.com/watch?v=A0VUsoeT9aM">2. A Youtube Video</a> blabla Text after';
?>
How would I do that?
preg_match_all()instead?\dor\w.