I currently have the following code in VB .Net:
CODE
Dim matchcollection As System.Text.RegularExpressions.MatchCollection
Dim currentmatch As System.Text.RegularExpressions.Match
Dim lowercasetag As String
matchcollection = Regex.Matches(lines, "\[(?i)(.+?)\]")
For Each currentmatch In matchcollection
lowercasetag = currentmatch.ToString.ToLower
lines = Regex.Replace(lines, "\[(?i)(.+?)\]", "[" & lowercasetag & "]")
Next
Dim currentmatch As System.Text.RegularExpressions.Match
Dim lowercasetag As String
matchcollection = Regex.Matches(lines, "\[(?i)(.+?)\]")
For Each currentmatch In matchcollection
lowercasetag = currentmatch.ToString.ToLower
lines = Regex.Replace(lines, "\[(?i)(.+?)\]", "[" & lowercasetag & "]")
Next
The variable lines comes in as a string. The Regex is supposed to detect BBCode tags regardless of case (which is does perfectly) and then drop the case down to lower case.
However, it seems that the lowercasetag variable cannot be understood by regex. I was wondering whether I was doing something wrong, or if there were an alternative way of doing this.
Thanks again!
