Regex question

philprice

Centurion
Joined
Mar 21, 2003
Messages
116
Location
Hull, UK
Hi there, i bascically want to alter all <a href="foobar"> links in a block of text to <a href="foobar" target="_blank">, this is what ive got so far

Code:
    Private Function alterAHrefLinks(ByRef strHTML As String) As String
        Dim strBuff As String
        Dim r As Regex
        r = New Regex("", RegexOptions.Compiled Or RegexOptions.IgnoreCase Or RegexOptions.Multiline)
        strBuff = r.Replace(strHTML, "<a href(.+?)>", "<a href=" + "http://www.philprice.net" + ">")
        Return strBuff
    End Function

obviously this replaces all links to my site ;) But anyway, how to i asses the match group that the (.+?) picks up within a substitution, i can do it in perl (im quite good at regex), but i just dont know where i need to be looking......
 
Back
Top