Regex search problem
Posted: Mon Jan 04, 2016 9:02 pm
Hello im having problems searching my string using regex it works fine when source is a static string but as soon as i download it via a webclient it dosent work, any sugguestions?
the regex search works fine but it does not work when the string is downloaded from webclient
heres part of the website it downloads, i cannot post entire html file or url the site is an adult site ...
Code: Select all
What im trying to do is get the text between, <a href="/dc/doujin/-/list/=/article=keyword/id=Test1/" class="genreTag__txt"> and its ending tag </a>Dim tReturn As New ArrayList
Dim strRegex As String = "<a href=""\/dc\/doujin\/-\/list\/=\/article=keyword\/id=.*\/"" class=""genreTag__txt"">(\s\n.*?)<\/a>"
Dim myRegex As New Regex(strRegex, RegexOptions.IgnoreCase Or RegexOptions.Multiline)
For Each myMatch As Match In myRegex.Matches(source)
If myMatch.Success Then
TextBox1.Text = TextBox1.Text & vbnewline & myMatch.Groups(1).Value.Trim
End If
Next
the regex search works fine but it does not work when the string is downloaded from webclient
heres part of the website it downloads, i cannot post entire html file or url the site is an adult site ...
Code: Select all
And this is my webclient
<ul class="genreTagList">
<li class="genreTagList__item">
<div class="m-genreTag">
<div class="genreTag__item">
<a href="/dc/doujin/-/list/=/article=keyword/id=Test1/" class="genreTag__txt">
Test1 </a>
</div>
</div>
</li>
<li class="genreTagList__item">
<div class="m-genreTag">
<div class="genreTag__item">
<a href="/dc/doujin/-/list/=/article=keyword/id=Test2/" class="genreTag__txt">
Test2 </a>
</div>
</div>
</li>
</ul>
Code: Select all
Dim WClient As New Net.WebClient
WClient.Encoding = System.Text.Encoding.UTF8
Dim source As String = WClient.DownloadString(url)