Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
C# Community
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
VB.NET
VB.NET General Discussion
Having problems with RegEx
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="digitaldrew, post: 180146, member: 41941"] I have a page I'm trying to go through and get a bunch of URL's from. There are about 50 URLs that match my regex code and my regex seams to work properly, but for some reason does not get every URL inside the content. Out of the entire page it only pulls 2 (the first one from each section)... A basic idea of the Content [CODE] <div class="fl" id="vListTop"> <div class="video"><a class="hRotator" href="urlhere"><div class="thumb_container" data-previewvideo="thumb"><img class="thumb" alt="here" src="source"><img class="hSprite" id="8094883" src="spacerGIF" sprite="JPGurl"></div><b>12:40</b><u>title</u></a><div class="hRate"><div class="fr">93%</div><div class="views-value">187,642</div></div></div><div class="video"><a class="hRotator" href="urlhere"><div class="thumb_container" data-previewvideo="thumb"><img class="thumb" alt="here" src="source"><img class="hSprite" id="8025312" src="spacerGIF" sprite="JPGurl"></div><b>13:17</b><u>title</u><div class="hSpriteHD"></div></a><div class="hRate"><div class="fr">98%</div><div class="views-value">69,747</div></div></div><div class="video"><a class="hRotator" href="urlhere"><div class="thumb_container" data-previewvideo="thumb"><img class="thumb" alt="here" src="source"><img class="hSprite" id="8139449" src="spacerGIF" sprite="JPGurl"></div><b>37:45</b><u>title</u><div class="hSpriteHD"></div></a><div class="hRate"><div class="fr">97%</div><div class="views-value">26,502</div></div></div><div class="clear"></div><div class="video"><a class="hRotator" href="urlhere"><div class="thumb_container" data-previewvideo="thumb"><img class="thumb" alt="here" src="source"><img class="hSprite" id="8096739" src="spacerGIF" sprite="JPGurl"></div><b>12:35</b><u>title</u><div class="hSpriteHD"></div></a><div class="hRate"><div class="fr">92%</div><div class="views-value">197,571</div></div></div><div class="clear"></div></div> <div style="float: right;"> <div class="avdo " id="usefulInfoBlock"> <div class="frame"><div style="margin: 0px auto; width: 300px; height: 250px; overflow: hidden;"><iframe width="300" height="250" src="advertisement" frameborder="0" scrolling="no" sandbox="allow-same-origin allow-popups allow-forms allow-scripts"></iframe></div></div> </div></div> <div class="clear"></div> <div class="video new-date"><div class="vDate">August 24, 2017</div><a class="hRotator" href="urlhere"><div class="thumb_container" data-previewvideo="thumb"><img class="thumb" alt="here" src="source"><img class="hSprite" id="8162046" src="spacerGIF" sprite="JPGurl"></div><b>01:20</b><u>title</u><div class="hSpriteHD"></div></a><div class="hRate"><div class="fr">100%</div><div class="views-value">1,236</div></div></div><div class="video"><a class="hRotator" href="urlhere"><div class="thumb_container" data-previewvideo="thumb"><img class="thumb" alt="here" src="source"><img class="hSprite" id="8152826" src="spacerGIF" sprite="JPGurl"></div><b>06:13</b><u>title</u><div class="hSpriteHD"></div></a><div class="hRate"><div class="fr">83%</div><div class="views-value">2,168</div></div></div><div class="video"><a class="hRotator" href="urlhere"><div class="thumb_container" data-previewvideo="thumb"><img class="thumb" alt="here" src="source"><img class="hSprite" id="8162395" src="spacerGIF" sprite="JPGurl"></div><b>08:21</b><u>title</u><div class="hSpriteHD"></div></a><div class="hRate"><div class="fr">100%</div><div class="views-value">4,368</div></div></div><div class="clear"></div><div class="pager"><table class="ac"><tbody><tr><td><div><a class="first" href="homepage" overicon="iconPagerPrevHover"><div class="icon iconPagerPrev"></div></div></td></tr></tbody></table></div></div> </div> </td></tr></tbody></table> [/CODE] My Code [CODE] Dim strReg As String strReg = "<a\s+class\s*=\s*""hRotator""\s+href\s*=\s*""?([^"" >]+)""?>(.+)</a>" Dim reg As New Regex(strReg, RegexOptions.IgnoreCase) Dim m As Match = reg.Match(htmlContent) While m.Success MsgBox(m.Groups(1).Value) m = m.NextMatch() End While [/CODE] and [CODE] Dim input As String = htmlContent For Each m As Match In Regex.Matches(input, "<a\s+class\s*=\s*""hRotator""\s+href\s*=\s*""?([^"" >]+)""?>(.+)</a>", RegexOptions.IgnoreCase And RegexOptions.IgnorePatternWhitespace And RegexOptions.Singleline) MsgBox(m.Groups(1).Value) Next [/CODE] Any help would be appreciated! [/QUOTE]
Insert quotes…
Verification
Post reply
VB.NET
VB.NET General Discussion
Having problems with RegEx
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top
Bottom