SQLite Forum

Broken logical NOT in ext/misc/regexp.c
Login

Broken logical NOT in ext/misc/regexp.c

(1.1) By andse-t610 on 2021-06-04 15:05:45 edited from 1.0

I have found that logical not operations like `[^something]`, `\W`, `\D` don't work when used alone (without modifiers like `+` `$`  `^`, except {}).

> select 'abc' regexp '\\W' ---> 1

> select '123' regexp '\\D' ---> 1

> select 'abc' regexp '[^a-z]' ---> 1

> select 'abc' regexp '\\W{1,1}' --> 1

> select 'abc' regexp '\\W{1}' --> 1


but

> select 'abc' regexp '\\W+' ---> 0

> select '123' regexp '^\\D' ---> 0

> select 'abc' regexp '[^a-z]$' ---> 0

> select 'abc' regexp '\\W{2}' --> 0


I suspect that something is wrong with the end-of-text event handling...

(2) By Richard Hipp (drh) on 2021-06-04 16:19:56 in reply to 1.1 [link]

Please try again with [check-in 569e00d4acd42666][1] or later.  The two
check-ins that follow fix harmless compiler warnings and missing dependencies
in the Makefile, so you might want to pick them up as well.


[1]: src:/timeline?c=569e00d4acd42666

(3) By andse-t610 on 2021-06-04 19:34:20 in reply to 2 [link]

Great job! Thank you!