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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:18:43+00:00 2026-05-23T07:18:43+00:00

if (Result.Contains(http://)) { string pattern = @(http://); theend = Result.Substring(Result.IndexOf(http://)); Regex rgx = new

  • 0
if (Result.Contains("http://"))
{
  string pattern = @"(http://)";
  theend = Result.Substring(Result.IndexOf("http://"));
  Regex rgx = new Regex(pattern);
  string replacement = "<a href="+theend+">"+theend+"</a> ";
  Result = rgx.Replace(Result, replacement);
}

The result is normal link (a href) and after that there is a string http://. How do I get only a link?

  • 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-23T07:18:44+00:00Added an answer on May 23, 2026 at 7:18 am

    Not clear exactly what are you trying to do. how does the input Result looks like.
    if Result only contains the URL then just change:

    Result = rgx.Replace(Result, replacement);
    

    to

    Result = replacement;
    

    Update:

    Anyway, You can use this function:

    private string ConvertUrlsToLinks(string msg) {
            string regex = @"((www\.|(http|https|ftp|news|file)+\:\/\/)[&#95;.a-z0-9-]+\.[a-z0-9\/&#95;:@=.+?,##%&~-]*[^.|\'|\# |!|\(|?|,| |>|<|;|\)])";
            Regex r = new Regex(regex, RegexOptions.IgnoreCase);
            return r.Replace(msg, "<a href=\"$1\">$1</a>").Replace("href=\"www", "href=\"http://www");
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have PHP variable that contains string like: http://domain.com/uploads/image1.jpg|||http://domain.com/uploads/image2.jpg|||http://domain.com/uploads/image3.jpg|||... I need to get first
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&
This results in a JSON string that contains street_number - http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false long_name : 1600,
I have a JSON result that contains numerous records. I'd like to show the
I have an array DetailsArray in VB.NET which contains the result of a LINQ
var result = db.PhotoAlbums.Select(albums => new PhotoAlbumDisplay { AlbumID = albums.AlbumID, Title = albums.Title,
At it's simplest, if file_1.php contains <?php session_start(); $_SESSION[test_message] = Hello, world; header(Location: http://localhost/file_2.php);
How? More to the point... this: $url = 'http://php.net/manual/en/class.domelement.php'; $client = new Zend_Http_Client($url); $response
When we have a string that contains space characters: var str = ' A
I'm having trouble getting a value from an xml string. $query_return_string contains the following

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.