Add class to a tag within a string : A little background.  I am loading the content from a wordpress site into an app programmed in framework7.  Due to this all external links break because they need to contain class="link external".  I am looking for a way to allow users to click the links and open a browser window.  The only way I could think of is some type of `preg_replace` that can identify if there are any links in the content string. I just cant think of a way to check if it already has a class and add to it or add the class attribute if it does not exist.