I’m terrible at writing regular expressions so am looking for some help.
I have the following string:
<li class="current-menu-item"><a title="Site Name" href="http://www.example.com/">Home</a></li>
An want to replace the hyperlink with a H1.
Is there a simple way to do this using regular expressions, bearing in mind the title, hyperlink and anchor text change?
‘]’ will match all characters except ‘>’, ‘*’ means it will match zero or more occurences of character(s) in front of it, then ‘>’ will be after that, then it will capture everything inside (), ‘\w’ will match any word character, + will match at least one occurence of character in front of it and then ” will appear (forward slashes need to be escaped).
$subject could be whole HTML document or just your string.