Click here to Skip to main content
13,089,536 members (70,352 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi, need help for a regular expression, cant really figure ir out myself.
I have a website, for example and I use this code to read the content of the website.

 StreamReader webSource = new StreamReader(webResponse.GetResponseStream());
                    string source = webSource.ReadToEnd();

So I need a regular expression match to find all the containig website url`s that are within the server. So I need to find all theese kind of links:");");;search=bcc6928a29fe348a30cbfc2dc1aba4ab&place=1");

And i dont want to find links like
Can anyone help with this?
Posted 26-Dec-12 9:15am
Zoltán Zörgő 26-Dec-12 15:21pm
- "url`s that are within the server" makes no sense, since you fetch only a single page, without references.
- you havce specified only absolute urls. You don't need the relative ones?
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This will find what you have specified:
More exactly it will search for it between matching single or double quotes. Group 2 will contain the url.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

I get a syntax error somehow

foreach (Match n in Regex.Matches(source, @(["'])(*?)\1"))

Please don't post non-answers as "Solution", it is considered as abuse. You can only get down-votes and abuse reports. Use comments or "Improve question".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 28 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100