Matching Numeric Strings with RegEx
Hello Everyone and thansk for your help in advance. I am working on an application that needs to parse links withing HTML. First, here are a few of the strings I am trying to work with:
profile.asp?LicId=87803&ProfNBR=1501
profile.asp?LicId=5934&ProfNBR=1901
As you can see, the numeric string after the LicId= is variable in length. I actually don't need to match anything after the numeric portion, so I can let the & termminate the match. The code I have tried is:
Dim MatchPattern As String = "profile.asp\?LicId\=[\d{2-6}]"
Dim mcLinks As MatchCollection
Dim mcLink As Match
mcLinks = Regex.Matches(html, MatchPattern, RegexOptions.IgnoreCase)
For Each mcLink In mcLinks
LinkData = LinkData & mcLink.ToString & vbCrLf
Next
However, the output returned is:
profile.asp?LicId=8
profile.asp?LicId=5
Not really sure why this isn't working. Once again, thanks for the help.
|