如何在某些文本中找到所有Guid?

Zac*_*son 4 .net regex vb.net guid

我的数据库中有一堆网页内容,链接如下:

<a href="/11ecfdc5-d28d-4121-b1c9-1f898ac0b72e">Link</a>
Run Code Online (Sandbox Code Playgroud)

Guid唯一标识符是同一数据库中另一个页面的ID .

我想抓取这些页面并检查链接是否损坏.

为此,我需要一个可以返回页面上所有Guid列表的函数:

Function FindGuids(ByVal Text As String) As Collections.Generic.List(Of Guid)
    ...
End Function

我认为这是正则表达式的工作.但是,我不知道语法.

Joe*_*orn 8

[0-9A-F] {8} - [0-9A-F] {4} - [0-9A-F] {4} - [0-9A-F] {4} - [0-9A-F ] {12}


dot*_*joe 8

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