[Gambas-user] RegExp not returning submatches

T Lee Davidson t.lee.davidson at gmail.com
Thu Oct 20 18:53:18 CEST 2022

 From http://gambaswiki.org/wiki/comp/gb.pcre/regexp/submatches:
"The SubMatches property is now deprecated. Use the Count property and the array accessor of the RegExp class directly."

That doesn't seem to work.

Given the following simple code:
Public Sub Main()

   Dim hRegex As RegExp

   hRegex = New RegExp("quick brown fox", "brown (\\S+)")
   Print hRegex.Text
   Print hRegex.Count
   For i As Integer = 0 To hRegex.Count - 1
     Print Subst("Index &1: &2", i, hRegex[i].Text)


The result in the IDE console is:
brown fox
Index 0: brown fox

I may be doing something wrong, but I don't know what it might be.


More information about the User mailing list