[Gambas-user] gb.pcre behaviour with Gambas3

Ron ron at ...1740...
Sun Feb 17 13:30:16 CET 2013


I'm sorry, I checked it again, but it wasn't reporting NULL but you
get an 'Out of Bounds error' while checking rReg.Text <> ""

See attached project and screenshot.

Regards,
Ron.


2013/2/17 Benoît Minisini <gambas at ...1...>:
> 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
>
> ------------------------------------------------------------------------------
> The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
> is your hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials, tech docs,
> whitepapers, evaluation guides, and opinion stories. Check out the most
> recent posts - join the conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
-------------- next part --------------
A non-text attachment was scrubbed...
Name: regexp.png
Type: image/png
Size: 55515 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20130217/6f61074e/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RegExp-0.0.1.tar.gz
Type: application/x-gzip
Size: 4882 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20130217/6f61074e/attachment.bin>


More information about the User mailing list