I'm doing a simple text validator function that replaces a couple of characters. I wanted to add a function that replaces links and emails with <a href="">.
In my text in order to create a link the user types: linkto:mypage.php<description> or mailto:bla@bla.com<mr bla>
I'm not sure how to go about this though:
Code: Select all
//patterns to replace
$patterns = array("/Å/", "/å/", "/Ä/", "/ä/", "/Ö/", "/ö/", "/linkto:[b][a-zA-Z0-9._-][/b]+<[b][a-zA-Z0-9._-\s][/b]+>/");
//replacements
$replacements = array("Å", "å", "Ä", "ä", "Ö", "ö", "<a href=\"[b]bla[/b]\">[b]bla2[/b]</a>");