Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6700773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:51:17+00:00 2026-05-26T06:51:17+00:00

I have a plain text, say, Hello how are you, please visit ‘http://google.com’ .

  • 0

I have a plain text, say, "Hello how are you, please visit 'http://google.com'".

I am displaying this in a div using jQuery (this text is being randomly generated). My question is, is there any way that I can detect that “http://google.com” in the text is a hyperlink and thereby convert that part of the text in to a clickable hyperlink?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:51:18+00:00Added an answer on May 26, 2026 at 6:51 am

    You can achieve this by doing:

    <?php
    
    // The Regular Expression filter
    
    $reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";
    
    // The Text you want to filter for urls
    
    $text = "Hello how are you, please visit http://google.com";
    
    // Check if there is a url in the text
    
    if(preg_match($reg_exUrl, $text, $url)) {
    
           // make the urls hyper links
    
           echo preg_replace($reg_exUrl, "<a href="{$url[0]}">{$url[0]}</a> ", $text);
    
    } else {
    
           // if no urls in the text just return the text
    
           echo $text;
    
    }
    ?>
    

    Here is a complete tutorial:
    Find URLs in text and make links

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a plain text file looking like this: some text containing line breaks
Lets say I have a plain text file example.txt and I have a PHP
I do have to deal with very large plain text files (over 10 gigabytes,
We are currently storing plain text passwords for a web app that we have.
I have about 40000 records in that table that contains plain text and within
Input: I have a LaTeX file, with plain text & math formulas. Desired output:
I have two large identical-sized files. One is ASCII plain text, and the other
I have a script set up to send out multipart emails; plain text and
We have 5mb of typical text (just plain words). We have 1000 words/phrases to
Lets say you have this enum: Public Enum ApplicationStatus <Foo(Active)> Active = 1 <Foo(Inactive)>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.