View Full Version : Question about regExp

06-05-2007, 08:21 PM
I found this code on the internet and I really don't know how this regExp works.
What're the $1$2$3 numbers on the code to convert to anchors?
If someone could explain me at least some of the code that would be great!

Function ReplaceRegExp(strString, strPattern, strReplace)

Dim RE: Set RE = New RegExp

With RE
.Pattern = strPattern
.Global = True
ReplaceRegExp = .Replace(strString, strReplace)
End With

End Function

Function BBCodeToHTML(strString)
strString = ReplaceRegExp(strString, "(http|ftp|https)(:\/\/[\w\-_]+)((\.[\w\-_]+)+)([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?", "<a href=""$1$2$3$5"" target=""_blank"">$1$2$3$5</a>")

06-06-2007, 01:23 PM
My RegExp is lousy, as I'm sure my previous posts will testify, but I THINK that the brackets in the regexp itself break matches into discrete sub-matches which can then be referenced via the dollar notation. Does that make sense?