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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:57:53+00:00 2026-05-15T05:57:53+00:00

I have a site that enables users to post messages to a forum. At

  • 0

I have a site that enables users to post messages to a forum.

At present, if a user types a web address or email address and posts it, it’s treated the same as any other piece of text.

There are tools that enable the user to supply hyper-linked web and email addresses (via some bespoke tags/markup) – these are sometimes used, but not always. In addition, a bespoke ‘Image’ tag can also be used to reference images that are hosted on the web.

My objective is to both cater for those that use these existing tools to generate hyper-linked addresses, but to also cater for those that simply type a web or email address in, and to then automatically convert this to a hyper-linked address for them (as soon as they submit their post).

I’ve found one or two regular expressions that convert a plain string web or email address, however, I obviously don’t want to perform any manipulation on addresses that are already being handled via the sites bespoke tagging, and that’s where I’m stuck – how to EXCLUDE any web or email addresses that are already catered for via the bespoke tagging – I wan’t to leave them as is.

Here are some examples of bespoke tagging for the variations that I need to be left alone:

[URL=www.msn.com]www.msn.com[/URL]

[URL=http://www.msn.com]http://www.msn.com[/URL]

[EMAIL=bob@smith.com]bob@smith.com[/EMAIL]

[IMG]www.msn.com/images/test.jpg[/IMG]

[IMG]http://www.msn.com/images/test.jpg[/IMG]

The following examples would however ideally need to be automatically converted into web & email links respectively:

www.msn.com

http://www.msn.com

bob@smith.com

Ideally, the ‘converted’ links would just have the appropriate bespoke tags applied to them as per the initial examples earlier in this post, so rather than:

<a href="..." etc.

they’d become:

[URL=http://www.. etc.)

Unfortunately, we have a LOT of historic data stored with this bespoke tagging throughout, so for now, we’d like to retain that rather than implementing an entirely new way of storing our users posts.

Any help would be much appreciated.

Thanks.

  • 1 1 Answer
  • 1 View
  • 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-15T05:57:53+00:00Added an answer on May 15, 2026 at 5:57 am

    Here’s the method I use. I don’t have access right now to the full codebase so can’t see how that fits in alongside the forum-code to stop double-linking, but try it out and see if it works for you…

    /// <summary>
        /// Turns any literal URL references in a block of text into ANCHOR html elements.
        /// </summary>
        public static string ActivateLinksInText(string source)
        {
            source = " " + source + " ";
            // easier to convert BR's to something more neutral for now.
            source = Regex.Replace(source, "<br>|<br />|<br/>", "\n");
            source = Regex.Replace(source, @"([\s])(www\..*?|http://.*?)([\s])", "$1<a href=\"$2\" target=\"_blank\">$2</a>$3");
            source = Regex.Replace(source, @"href=""www\.", "href=\"http://www.");
            //source = Regex.Replace(source, "\n", "<br />");
            return source.Trim();
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web site which enables user to add or delete their own
I have a merchandising web site that allows user to buy stuff on my
I'm working on a functionality in my asp.net web site that enables the user
I have a web service site that is restful enabled, so other websites/ajax script
I have a site that has a /sites/default/files/ directory where user content is typically
I am trying to build a web application that enables users to refer people
I am developing a site (ASP.Net based) that, besides other features enables the users
I have a web application which enables users to upload files. The files are
We are developing a web app that enables the end user to place a
I have a site that i want to redirect all requests accept for 1

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.