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

  • SEARCH
  • Home
  • 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 7510169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:08:53+00:00 2026-05-29T23:08:53+00:00

I know its a bit long. I’m trying to catch up on a deadline

  • 0

I know its a bit long. I’m trying to catch up on a deadline and if anyone could help me, I would gladly appreciate it. Another friend programmer of mine made this PHP script but unfortunately its already deprecated and doesn’t work. Can anyone convert this to preg? I know nothing about eregi, preg, rejex, etc.

    function tolink($text){

    $text = " ".$text;

    $text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)',

    '<a href="\\1" target="_blank" rel="nofollow">\\1</a>', $text);

    $text = eregi_replace('(((f|ht){1}tps://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)',

    '<a href="\\1" target="_blank" rel="nofollow">\\1</a>', $text);

    $text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)',

    '\\1<a href="http://\\2" target="_blank" rel="nofollow">\\2</a>', $text);

    $text = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,4})',

    '<a href="mailto:\\1"  rel="nofollow">\\1</a>', $text);

    return $text;

    }
  • 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-29T23:08:57+00:00Added an answer on May 29, 2026 at 11:08 pm

    wouldn’t it be like this

      function tolink($text){
     $text = " ".$text;
     $text = preg_replace("/(((f|ht){1}tp:\/\/)[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/","<a href=\"$1\" target=\"_blank\" rel=\"nofollow\">$1</a>", $text);
    $text = preg_replace("/(((f|ht){1}tps:\/\/)[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/","<a href=\"$1\" target=\"_blank\" rel=\"nofollow\">$1</a>", $text);
     $text = preg_replace("/([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/",
                          "$1<a href=\"http://$2\" target=\"_blank\" rel=\"nofollow\">$2</a>", $text);
    
     $text = preg_replace('/([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,4})/',
                          "<a href=\"mailto:$1\"  rel=\"nofollow\">$1</a>", $text);
     return $text;
    

    }

    you can also append i at the end of preg_replace pattern to make so that lowercase and uppercase character will be matched

    this is what i mean

     preg_replace('/(((f|ht){1}tp:\/\/)[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/i' .....
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was trying to learn unit test with PHP. I know it's a bit
I know its possible to receive a dayClick event on Fullcalendar. But I would
I know the title sound confusing and thats because it is. its a bit
Does anyone know whether it's possible to stop Visual Studio 2010 from rearranging its
What does this bit of code represent? I know it's some kind of if
I'd like to know whether it's possible to clear the NTFS dirty bit in
I know its possible to accept a list of objects as a parameter thanks
I know its possible to use a wakelock to hold the screen, cpu, ect
I know its impossible for 100% protection, but something high or that works for
I know its possible to open an app from mobile safari using custom URL

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.