Sub ExtractURLsFromString(TargetString As String) As List
Dim Matcher As Matcher
Dim URLPattern As String
Dim Result As List
Result.Initialize
' This pattern matches URLs starting with http://, https://, or www. and includes those without these prefixes.
' Adjust the pattern as needed for more specific use cases.
URLPattern = "(https?://)?(www\.)?[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,}(/\S*)?"
Matcher = Regex.Matcher(URLPattern, TargetString)
Do While Matcher.Find
Result.Add(Matcher.Match)
Loop
Return Result
End Sub