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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:13:44+00:00 2026-05-29T23:13:44+00:00

I started learning REGEX 2 days ago , now id like to make a

  • 0

I started learning REGEX 2 days ago , now id like to make a small application that read the source code of a webpage and get webpages like http://page.com or http://www.page.com/sub/sub/sub?=value , etc….. , stuff like that , anyway that`s the code i typed :

Regex r = new Regex("http://\\w");

        HttpWebRequest httpwebrequest = (HttpWebRequest)WebRequest.Create("http://maktoob.yahoo.com/?p=us");
        HttpWebResponse response = (HttpWebResponse)httpwebrequest.GetResponse();

        StreamReader sr = new StreamReader(response.GetResponseStream());

        string line;

        while ((line = sr.ReadLine()) != null)
        {
            Match m = r.Match(line);
            if (m.Success)
            {
                Console.WriteLine("Match: " +m.Value);
            }
        }
        sr.Close();
        response.Close();

But the result is :

Match: http://l
Match: http://w
Match: http://x
Match: http://l
Match: http://q

It just get the first character after //
When i looked at my pattern i said lol yeah my pattern is http://\w , so it will get the first character , but i wanted to know what should i add to my pattern for it to get the rest of the 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-29T23:13:45+00:00Added an answer on May 29, 2026 at 11:13 pm

    If you only need to match hyperlinks within <a> elements, then you could take advantage of the enclosing quotes or double quotes to delimit your URL.

    Regex regex = new Regex(@"(?<=href=('|""))https?://.*?(?=\1)");
    

    That would match any text within an href='…' or href="…" attribute that starts with http:// or https://.

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

Sidebar

Related Questions

I started learning jQuery just yesterday, and I like it very much. And now
I've started learning rails3 few days ago, and since today, every time I run
I started learning rails a few days ago and I'm reading head first rails
I started learning scala a few days ago and when learning it, I am
I started learning JavaScript a while ago. It's a fairly easy programming language considering
I recently started learning Emacs . I went through the tutorial, read some introductory
Since I started learning F# and OCaml last year, I've read a huge number
I started learning LISP and I heard that there is some kind of a
I started learning vim today and installed it using sudo apt-get install vim Now,
i have just started learning linq because i like the sound of it. and

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.