' Collection of code snippets by Arne Vajhøj 
' (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
﻿Imports System
Imports System.Text.RegularExpressions

Namespace E
    Public Class Program
        Public Shared Sub Main(args As String())
            Dim html As String = "<html>" & vbCr & vbLf & "    <head>" & vbCr & vbLf & "        <title>test</title>" & vbCr & vbLf & "        <link rel=""stylesheet"" href=""css/main.css"" type=""text/css"">" & vbCr & vbLf & "    </head>" & vbCr & vbLf & "    <body>" & vbCr & vbLf & "        <img src=""img/logo.png"" />" & vbCr & vbLf & "        <a href='/something.ext'>click here</a>" & vbCr & vbLf & "    </body>" & vbCr & vbLf & "</html>"
            Dim re As New Regex("\s+((href)|(src))\s*=\s*['""]\s*([^'""]+)\s*['""]", RegexOptions.IgnoreCase)
            For Each m As Match In re.Matches(html)
                Console.WriteLine(m.Groups(4).Value)
            Next
        End Sub
    End Class
End Namespace
