get string, convert <a> tags to <div> with onclick on the href attribute
function convert($string) { // convert string to dom // get all <a> tags // convert to <div> // add onclick to the converted divs // convert dom back to string // return the string }