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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:36:55+00:00 2026-05-13T05:36:55+00:00

http://stackoverflow.com should become <a href=http://stackoverflow.com>http://stackoverflow.com</a> EDIT: It would be great if anchor tags from

  • 0
http://stackoverflow.com

should become

<a href="http://stackoverflow.com">http://stackoverflow.com</a>

EDIT: It would be great if anchor tags from the original string stayed intact.

  • 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-13T05:36:56+00:00Added an answer on May 13, 2026 at 5:36 am

    John Gruber just posted an interesting regex example to capture URLs:
    Daring Fireball regex to get URLs

    To cut to the chase, the (liberal, long) pattern he chose was:

    \b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))
    

    That posits to capture all of the following:

    http://foo.com/blah_blah
    http://foo.com/blah_blah/
    (Something like http://foo.com/blah_blah)
    http://foo.com/blah_blah_(wikipedia)
    (Something like http://foo.com/blah_blah_(wikipedia))
    http://foo.com/blah_blah.
    http://foo.com/blah_blah/.
    <http://foo.com/blah_blah>
    <http://foo.com/blah_blah/>
    http://foo.com/blah_blah,
    http://www.example.com/wpstyle/?p=364.
    http://✪df.ws/123
    rdar://1234
    rdar:/1234
    http://userid:password@example.com:8080
    http://userid@example.com
    http://userid@example.com:8080
    http://userid:password@example.com
    http://example.com:8080 x-yojimbo-item://6303E4C1-xxxx-45A6-AB9D-3A908F59AE0E
    message://%3c330e7f8409726r6a4ba78dkf1fd71420c1bf6ff@mail.gmail.com%3e
    http://➡.ws/䨹
    www.➡.ws/䨹
    <tag>http://example.com</tag>
    Just a www.example.com link.
    

    So you’d use that pattern with something like preg_filter, and then iterate over the returned array of matches somehow. I guess. I hate regex.

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

Sidebar

Related Questions

the regexp \<div class=g\>.*?\<a href=\?(http:\/\/stackoverflow.com\/)\?.*?\>.*?\<a href=\?(.+?)\?.*?\>.*?\<\/div\> the target <div class=g> <link rel=prefetch href=https://stackoverflow.com/> <h2
I'm trying to make a clickable region. <a style=display: block href=http://stackoverflow.com> StackOverflow </a> A
I found this on another stack question: //http://stackoverflow.com/questions/3418231/c-replace-part-of-a-string-with-another-string // void replaceAll(std::string& str, const std::string&
I have a one String in classic asp. Dim str str = http://stackoverflow.com/questions/ask/code-classic-asp-in-linux In
Using jQuery and given this <ul> <li> <a external=http://stackoverflow.com href=home.htm>Link 1</a> </li> <li> <a
Check this URL: http://api.stackoverflow.com/1.1/users/811785/questions?sort=votes It's a URL from StackOveflow's API. The returned JSON is
For example: http://stackoverflow.com/questions/396164/exposing-database-ids-security-risk and http://stackoverflow.com/questions/396164/blah-blah loads the same question. (I guess this is DB
Notice how the default domain for stackoverflow is http://stackoverflow.com and if you try to
I am wondering why the link to profile looks like: http://stackoverflow.com/users/ID/NAME not simply: http://stackoverflow.com/users/ID
In short, why use something like http://stackoverflow.com/badges/6/supporter instead of something simpler (and subjectively, at

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.