[Gambas-user] RegExp not returning submatches

gian bagoneo at libero.it
Thu Oct 20 23:31:30 CEST 2022


Il 20/10/22 18:53, T Lee Davidson ha scritto:

> That doesn't seem to work.
> 
> Given the following simple code:
> [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)
>    Next
> 
> End
> [/code]
> 
> The result in the IDE console is:
> brown fox
> 1
> Index 0: brown fox
> 
> 
> I may be doing something wrong, but I don't know what it might be.
> 
> 

Hi Lee,

to me your code is correct and is based on what is written in the Gambas 
wiki.

I think this is a bug that should be reported.

Regards

Gianluigi


More information about the User mailing list