Regex question

philprice

Well-known member
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......
 

Similar threads

E
Replies
0
Views
88
etl2016
E
R
Replies
0
Views
124
Richard.Haggard
R
I
Replies
0
Views
150
Innovators World Wide
I
M
Replies
0
Views
116
Mostafa Salaheldien
M
Back
Top