Language/Platform: VB.NET 2008
Project: I am creating a program to search HTML source code for a very specific URL string.
Issue: I am not good with these regular expressions at all and am having trouble getting what I need.
Here is what I have so far in VB.NET:
Dim testNum As MatchCollection = Regex.Matches(TextBox1.Text, "<a href='series.php\?ID=[0-9]'>[^</a>]</a>")
If testNum.Count = 0 Then
End
Else
MessageBox.Show(testNum.Count)
End If
Expression: <a href='series.php\?ID=[0-9]'>[^</a>]</a>
Sample Text:
<a href='series.php?ID=23'>Aishiteru ze Baby ( Love You Baby )</a>
<a href='series.php?ID=230'>Akage no Anne ( Anne of Green Gables )</a>
There is an ID number that is variable in Integer value and length directly after ID=.
Between the HTML anchor tags, there is variable text that can have any length and any characters.
I run my code and no values are being returned (The count of the Match collection is 0).
I know my code is correct because if I just do a search for a single character, I get results. ("a" = 14 matches)
So, I'm totally lost and have no idea what is wrong with my code as, for some reason, I am totally not grasping this RegEx thing entirely and what constitutes an illegal expression.
Thanks for any help provided.