Earlier today I asked a question about having regex solution for replacing hrefs of all links in html with return fo some function..
Then I deleted it because it seemed I could work around with it using DomDocument, but It turns out, I can't...
See my html has got lots of wrong html syntex, html5 code etc, etc..So neither loadHTML, loadXML is working..
Please if someone can provide solution with regex to look-for href's and replace using calling a function on all..I've tried preg_replace, and preg_replace_callback, but I can't understand the $1, $2..whole concept.. I've searched all similar questions, but they all have answers of DomDocumenet, which I can't use..
Old similar questions: Grabbing the href attribute of an A element
Find all hrefs in page and replace with link maintaining previous link - PHP
but I need regex solution