bcoffin Posted March 30, 2006 Share Posted March 30, 2006 Could somebody please recommend a good way to input a textarea's contents and return the same contents, whereas all patterns matching a URL or EMAIL address are auto-linked?ie:Aliquam posuere iaculis [!--coloro:#CC6600--][span style=\"color:#CC6600\"][!--/coloro--]www.augue.com[!--colorc--][/span][!--/colorc--]. Mauris dictum pellentesque ipsum. Nam lacus. Sed mattis commodo lectus. Duis malesuada, lorem et gravida mattis, magna purus viverra orci, id tempus ante lorem et arcu. Nullam congue orci at metus. Ut tortor pede, placerat a, tristique eget, tempor id, augue. Mauris tincidunt risus sit amet diam. Mauris vehicula lectus eu dui. Aenean porttitor gravida purus. Vivamus nisl ipsum, aliquam sed, tincidunt vitae, dictum quis, purus. [!--coloro:#CC6600--][span style=\"color:#CC6600\"][!--/coloro--]Nam@bibendum.com [!--colorc--][/span][!--/colorc--]diam. becomesAliquam posuere iaculis [!--coloro:#CC6600--][span style=\"color:#CC6600\"][!--/coloro--]<a href='www.augue.com' target='_new'>www.augue.com</a>[!--colorc--][/span][!--/colorc--]. Mauris dictum pellentesque ipsum. Nam lacus. Sed mattis commodo lectus. Duis malesuada, lorem et gravida mattis, magna purus viverra orci, id tempus ante lorem et arcu. Nullam congue orci at metus. Ut tortor pede, placerat a, tristique eget, tempor id, augue. Mauris tincidunt risus sit amet diam. Mauris vehicula lectus eu dui. Aenean porttitor gravida purus. Vivamus nisl ipsum, aliquam sed, tincidunt vitae, dictum quis, purus. [!--coloro:#CC6600--][span style=\"color:#CC6600\"][!--/coloro--]<a href='mailto:Nam@bibendum.com'>Nam@bibendum.com</a>[!--colorc--][/span][!--/colorc--] diam. THANKS for your help, you guys,Benny Quote Link to comment https://forums.phpfreaks.com/topic/6199-auto-link-age/ Share on other sites More sharing options...
ober Posted March 30, 2006 Share Posted March 30, 2006 You're going to want to use preg_replace(). If you don't know how to use regular expressions, check out this site: [a href=\"http://www.regular-expressions.info/\" target=\"_blank\"]http://www.regular-expressions.info/[/a] Quote Link to comment https://forums.phpfreaks.com/topic/6199-auto-link-age/#findComment-22375 Share on other sites More sharing options...
bcoffin Posted March 30, 2006 Author Share Posted March 30, 2006 I found this [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=89136&hl=\" target=\"_blank\"]thread[/a], but the regex_build_url function isn't recognized. (And it doesn't address the email part). Quote Link to comment https://forums.phpfreaks.com/topic/6199-auto-link-age/#findComment-22382 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.