[Gambas-user] Match operator always matches Null

Tobias Boege taboege at ...626...
Sat Feb 28 16:20:28 CET 2015


On Sat, 28 Feb 2015, Beno?t Minisini wrote:
> Le 27/02/2015 00:34, Tobias Boege a ?crit :
> > On Fri, 27 Feb 2015, Tobias Boege wrote:
> >> Hi,
> >>
> >> I feel like I already asked about this but didn't find it in my archives, so
> >> I probably didn't... We saw that the Match operator always matches the emtpy
> >> string
> >>
> >
> > In case you didn't know, the "emtpy string" is another expression for "empty
> > string".
> >
> 
> Fixed in revision #6919: Now the emtpy string only matches the etpmy 
> string. :-)
> 

===================================================================
--- regexp.c    (revision 6918)
+++ regexp.c    (working copy)
@@ -170,6 +170,9 @@
        CREGEXP tmp;
        bool ret = FALSE;

+       if (lsubject <= 0)
+               return (lpattern <= 0);
+
        CLEAR(&tmp);
        tmp.ovecsize = OVECSIZE_INC;
        GB.Alloc(POINTER(&tmp.ovector), sizeof(int) * tmp.ovecsize);
===================================================================

I don't think it's as simple as that :-) For now

  $ gbx3 -e 'Null Match "a*"'
  False

but "a*" is zero or more a's and Null should match it.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list