Why doesn’t this match properly?
[code] Dim re As New RegEx
re.SearchPattern = “a”
re.ReplacementPattern = “the”
re.Options.ReplaceAllMatches = True
Dim t As String = “a bus drove on a street in a town”
Dim match As RegExMatch = re.Search(t)
If match <> Nil Then
t = re.Replace()
End If
break[/code]
This outputs a bus drove on the street in the town
Why doesn’t it return the bus drove on the street in the town
?
I originally wanted to replace this:
[code] dim t1 as string
t="<part1.part2.part3>"
re.SearchPattern = “part1.part2.part3”
re.ReplacementPattern = “newpart1.newpart2.newpart3”
re.Options.ReplaceAllMatches = True
match = re.Search(t)
If match <> Nil Then
t1 = re.Replace()
End If
break[/code]
But this did not work, so tried the example. The code DOES go inside the match if block.
FYI using MBS plugins I get what I ask for
Xojo 2015r2.4 & Xojo 2015r3