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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:34:06+00:00 2026-06-12T05:34:06+00:00

I browsed around for a solution and I am sure it’s a simple question

  • 0

I browsed around for a solution and I am sure it’s a simple question but still not sure how to do that. So, I have a string that contains many words and some times it has links in it. For example:

I like the website http://somesitehere.com/somepage.html and I suggest you try it too.

I want to display the string in my view and have all links automatically converted to URLs.

@Model.MyText

Even StackOverflow gets it.

  • 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-06-12T05:34:07+00:00Added an answer on June 12, 2026 at 5:34 am

    @Hunter is right.
    In addition i found complete implementation in C#: http://weblogs.asp.net/farazshahkhan/archive/2008/08/09/regex-to-find-url-within-text-and-make-them-as-link.aspx.

    In case original link goes down

    VB.Net implementation

    Protected Function MakeLink(ByVal txt As String) As String
        Dim regx As New Regex("http://([\w+?\.\w+])+([a-zA-Z0-9\~\!\@\#\$\%\^\&\*\(\)_\-\=\+\\\/\?\.\:\;\'\,]*)?", RegexOptions.IgnoreCase)
    
        Dim mactches As MatchCollection = regx.Matches(txt)
    
        For Each match As Match In mactches
            txt = txt.Replace(match.Value, "<a href='" & match.Value & "'>" & match.Value & "</a>")
        Next
    
        Return txt
    End Function
    

    C#.Net implementation

    protected string MakeLink(string txt) 
    { 
       Regex regx = new Regex("http://([\\w+?\\.\\w+])+([a-zA-Z0-9\\~\\!\\@\\#\\$\\%\\^\\&amp;\\*\\(\\)_\\-\\=\\+\\\\\\/\\?\\.\\:\\;\\'\\,]*)?", RegexOptions.IgnoreCase); 
    
       MatchCollection mactches = regx.Matches(txt); 
    
       foreach (Match match in mactches) { 
        txt = txt.Replace(match.Value, "<a href='" + match.Value + "'>" + match.Value + "</a>"); 
       }
       return txt; 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have browsed around and haven't found a solution that specifically tailors to my
I have browsed thru other postings on S/O, but I can't find a solution
I'm playing around with a simple webserver written in F#. As I have noticed,
DISCLAIMER: Yes, I know the solution is not optimal, but it is what it
I have browsed around and other solutions don't seem to be working for me
I want to get smarter in AJAX, but not sure which way to go.
I have a large set (around 100) of page elements that I would like
Iv looked around for a existing lib/solution for what I want but can't find
I have a Visual Studio 2008 solution with around 10 projects. When I add include directories
I'm trying to work with a database that I have, but I can't display

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.