[Gambas-user] gb.pcre behaviour with Gambas3

Benoît Minisini gambas at ...1...
Sun Feb 17 13:19:20 CET 2013


Le 16/02/2013 20:53, Ron a écrit :
> Hi,
>
> I noticed that the behavior of the gb.pcre component has changed in
> Gambas3 compared to Gambas2.
>
> This use to work:
>
> PRIVATE FUNCTION GetData(sRaw AS String) AS String[]
>
>    DIM rReg AS NEW Regexp
>    DIM aMatches AS NEW String[]
>    DIM sTmp AS String
>
>    sTmp = sRaw
>    rReg.Compile("\x03\x03(\\w+)\r\n")
>    rReg.Exec(sTmp)
>
>    DO WHILE rReg.Text <> ""
>      aMatches.Add(rReg.Text)
>      sTmp = Mid(sTmp, rReg.Offset + 2)
>      rReg.Exec(sTmp)
>    LOOP
>
>    RETURN aMatches
>
> END
>
> But it doesn't anymore because in Gambas3 when a pattern isn't found
> rReg.Text is NULL instead of empty like in Gambas2.
> So it errors out because you cannot check a NULL object like this.

In Gambas, NULL = empty, so I don't understand your problem. Can you 
describe it more precisely? What you expect, and what you get instead?

Thanks.

-- 
Benoît Minisini




More information about the User mailing list