Replace some text matches with url link with text as anchor text

By Allen Stoner

Do you want to replace text on your web site with a link to a url, but don't want to do it everytime? An application of this could be everytime someone's name appears to replace it with a link to their bio page. To take this to the next level the attached code accepts a parameter to determine the chance that a particular match has of getting replaced, so it is possible to only replace 80% of the matches.