I've got a bunch of web page content in my database with links like this:
<a href="/11ecfdc5-d28d-4121-b1c9-1f898ac0b72e">Link</a>
That Guid unique identifier is the ID of another page in the same database.
I'd like to crawl those pages and check for broken links.
To do that I need a function that can return a list of all the Guids on a page:
Function FindGuids(ByVal Text As String) As Collections.Generic.List(Of Guid)
...
End Function
I figure that this is a job for a regular expression. But, I don't know the syntax.
Function FindGuids(ByVal Text As String) As List(Of Guid)
Dim Guids As New List(Of Guid)
Dim Pattern As String = "[a-fA-F0-9]{8}-([a-fA-F0-9]{4}-){3}[a-fA-F0-9]{12}"
For Each m As Match In Regex.Matches(Text, Pattern)
Guids.Add(New Guid(m.Value))
Next
Return Guids
End Function
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With