Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C#
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 10:15am
Zoltán Zörgő at 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"))
Sergey Alexandrovich Kryukov at 6-Nov-13 12:10pm
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
0 DamithSL 495
1 Maciej Los 258
2 OriginalGriff 229
3 BillWoodruff 170
4 Zoltán Zörgő 165
0 OriginalGriff 7,934
1 DamithSL 6,084
2 Sergey Alexandrovich Kryukov 5,449
3 Maciej Los 5,174
4 Kornfeld Eliyahu Peter 4,539

Advertise | Privacy | Mobile
Web04 | 2.8.141223.1 | Last Updated 28 Dec 2012
Copyright © CodeProject, 1999-2014
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