Jump to content

nick.ginsberg

Members
  • Posts

    1
  • Joined

  • Last visited

nick.ginsberg's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Hello all,I'm working on a coding project. What I need to do is take a certain part of the text and add something to the beginning and end (more specifically, html tags). Basically what I want to do is that given a paragraph of text, if there is a URL within that paragraph to add link tags to the beginning and end. Here is an example. Say someone goes to post this:You should go to www.google.com because it is a great website.I would like www.google.com to automatically be put in between URL tags. I can do something along the lines of str_replace("http://www.","<a href='http://www.'",$post), but that will only put the tag in the front--i need a way to close them. I've been told to use preg_replace somehow but I'm not sure how that is done.Thanks.Nick
×
×
  • Create New...