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 5959569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:42:13+00:00 2026-05-22T18:42:13+00:00

Really stuck on what seems to be something simple. I have a chatbox/shoutbox where

  • 0

Really stuck on what seems to be something simple. I have a chatbox/shoutbox where there may be arbitrary URLs entered. I want to find each individual URL (separated by spaces) and wrap it in tags.

Example: Harry you're a http://google.com wizard! = Harry you're a $lhttp://google.com$l wizard!

Example: Harry you're a http://www.google.com wizard! = Harry you're a $lhttp://www.google.com$l wizard!

Example: Harry you're a www.google.com wizard! = Harry you're a $lwww.google.com$l wizard!

Sorry if this is a daft question; I’m just trying to make something work and I’m no php expert 🙁

  • 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-22T18:42:13+00:00Added an answer on May 22, 2026 at 6:42 pm

    There is an interesting article about a URL regular expression. In PHP this would look like:

    $pattern = "/(?i)\b((?:https?:\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'\".,<>?«»“”‘’]))/";
    
    $inp = "Harry you're a http://google.com wizard!";
    $text = preg_replace($pattern, "[supertag]$1[/supertag]", $inp);
    

    And of course replace [supertag] and [/supertag] with the appropriate values.

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

Sidebar

Related Questions

I am stuck with something quite simple but really annoying: I have an xml
I seem to be really stuck on something. I have a function to check
I'm really stuck trying to find out how to force a programmatic refresh of
I realize this question is pretty basic, but I'm really stuck. I have a
I'm stuck on a problem I really don't know how to solve: I have
I'm new to JQuery, i suppose that's really simple but I can't find the
i stuck with a problem which is really important i guess. In a simple
I'm really stuck on why the following code block 1 result in output 1
I'm really stuck trying to use java wrapper library for opencv's cvMatchTemplate. See this
I am really hoping someone can help me out, because I'm really stuck on

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.