Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Hyperlinking a block of text

Enthusiast ,
Mar 10, 2008 Mar 10, 2008
I have a block of text that I retrieve from the sql dbase. I then need to display this on the site. However, what I need to do is search for any hyperlinks, which could be defined by strings that start with HTTP:// and then replace them with <A href="THELINK">THELINK</a>, so that the links all hyperlink when displayed.

There will be multiple links in one block of text.

Does anybody have any code that code take care of this? I guess replacenocase will come into place somehow

Thanks

Mark
TOPICS
Advanced techniques
402
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 10, 2008 Mar 10, 2008
What will the links end with?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 10, 2008 Mar 10, 2008
that is an unknown as our usres type in their own text and URL's. However the proceeding character has to be a space

So it would being with HTTP:// and the decided character at the end would be a space.

Example
I think you should go to http://www.google.com to search for the information

By locating the http:// and the space after the .com it could be hyperlinked.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 10, 2008 Mar 10, 2008
Actually, I was asking about the starting point for the closing anchor tag.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 10, 2008 Mar 10, 2008
LATEST
That would still be the space?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources