Magneto
10/09/2020, 6:00 PMSELECT * from users WHERE username NOT LIKE '_%';
returns nothing, but SELECT * FROM users WHERE username NOT LIKE '_a%';
returns expected results (I get _d and _k and _n usernames, but no _a results). v4.2.0 am I crazy?zwass
10/09/2020, 6:05 PM_
being a special character in sqlite: https://sqlite.org/lang_expr.html
An underscore ("_") in the LIKE pattern matches any single character in the string.
'_%'
will match any string with at least 1 character.Magneto
10/09/2020, 6:10 PMzwass
10/09/2020, 6:10 PMosquery> select 'zwass' LIKE '_%', '_zwass' LIKE '_%', 'zwass' LIKE '\_%' ESCAPE '\', '_zwass' LIKE '\_%' ESCAPE '\';
'zwass' LIKE '_%' = 1
'_zwass' LIKE '_%' = 1
'zwass' LIKE '\_%' ESCAPE '\' = 0
'_zwass' LIKE '\_%' ESCAPE '\' = 1
Magneto
10/09/2020, 6:13 PMseph
10/09/2020, 6:14 PMselect username from users where instr(username, "_") != 1;
Magneto
10/09/2020, 6:22 PMSELECT * FROM users WHERE username NOT LIKE '\_%' ESCAPE '\';
was what I ended up with, gives me most everything I anticipate.seph
10/09/2020, 6:28 PMzwass
10/09/2020, 6:30 PMseph
10/09/2020, 6:30 PM