Jump to content

Trykiz

New Members
  • Posts

    1
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Trykiz's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Trykiz

    Regex

    Hi, I need help with regex. I need to replace all urls (http://example.com) with <a href='http://example.com'>http://example.com</a> this, but if In text already exist <a href='http://example.com'>http://example.com</a> do nothing with it. Example text: Maecenas ornare viverra rhoncus http://google.com . Donec pulvinar ipsum nec felis mollis non iaculis turpis pellentesque <a href='http://example.com'>http://example.com</a> . Pellentesque vel convallis lacus <a href='http://www.phpfreaks.com'>phpfreaks</a> . preg_replace('/(http:\/\/[a-zA-Z0-9.\/=@]+)/', '<a href=\\1>\\1</a>', $param); But it's replacing <a href='http://www.phpfreaks.com'>phpfreaks</a> to <a href='<a href='http://www.phpfreaks.com'>http://www.phpfreaks.com</a>'>phpfreaks</a> Thanks! Sorry for wrong categorie
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.