有关reg表达式的帮助

有关reg表达式的帮助

本文介绍了有关reg表达式的帮助?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要正常表达方面的帮助,不能自己解决问题。

我有一个网站,例如http://www.website.com我用这段代码来阅读网站的内容。



Hi, need help for a regular expression, cant really figure ir out myself.
I have a website, for example http://www.website.com and I use this code to read the content of the website.

StreamReader webSource = new StreamReader(webResponse.GetResponseStream());

                   string source = webSource.ReadToEnd();



所以我需要一个正则表达式匹配来查找服务器内的所有包含网站URL。所以我需要找到所有这些链接:



http://www.website.com/search/84f2fbfcf85129866221a71b7d48f2da/?cat=124\");

http://www.website.com/search/7569ac370abc2aa02cd3e0760c418cc9/?sCat=38);

http://www.website.com/show/?i= 2368173& popup = 1mp; search = bcc6928a29fe348a30cbfc2dc1aba4ab& place = 1);



我不想找到像
这样的链接
http: //www.OTHERwebsite.com/search/84f2fbfcf85129866221a71b7d48f2da/?sCat=124&

任何人都可以帮忙吗?


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:

http://www.website.com/search/84f2fbfcf85129866221a71b7d48f2da/?sCat=124");
http://www.website.com/search/7569ac370abc2aa02cd3e0760c418cc9/?sCat=38");
http://www.website.com/show/?i=2368173&popup=1mp;search=bcc6928a29fe348a30cbfc2dc1aba4ab&place=1");

And i dont want to find links like
http://www.OTHERwebsite.com/search/84f2fbfcf85129866221a71b7d48f2da/?sCat=124&
Can anyone help with this?

推荐答案


foreach (Match n in Regex.Matches(source, @(["'])(http://www.website.com/.*?)\1"))
                    {







?


这篇关于有关reg表达式的帮助?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 11:46