Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sqlite3-为什么GLOB不';你不能用^$边界工作吗?_Sql_Sqlite_Glob - Fatal编程技术网

Sqlite3-为什么GLOB不';你不能用^$边界工作吗?

Sqlite3-为什么GLOB不';你不能用^$边界工作吗?,sql,sqlite,glob,Sql,Sqlite,Glob,这不起作用: pc@pc-host:~/MyScripts/sqltest$ sqlite3 --version 3.23.1 2018-04-10 17:39:29 4bb2294022060e61de7da5c227a69ccd846ba330e31626ebcd59a94efd148b3b pc@pc-host:~/MyScripts/sqltest$ sqlite3 sampledb.db sqlite> .schema students CREATE TABLE studen

这不起作用:

pc@pc-host:~/MyScripts/sqltest$ sqlite3 --version
3.23.1 2018-04-10 17:39:29 4bb2294022060e61de7da5c227a69ccd846ba330e31626ebcd59a94efd148b3b

pc@pc-host:~/MyScripts/sqltest$ sqlite3 sampledb.db

sqlite> .schema students
CREATE TABLE students(id integer primary key,name text,country text, thereal real, theint integer);

sqlite> select * from students;
id          name        country     thereal     theint    
----------  ----------  ----------  ----------  ----------
1           Michael     usa         12.6        12        
2           John        usa         5.78        5         
3           Jack        usa         12.6        12        
4           Sara        usa         5.78        5         
5           Sally       usa         12.6        12        
6           Jena        usa         5.78        5         
7           Nancy       usa         12.6        12        
8           Adam        usa         5.78        5         
9           Stevens     usa         12.6        12  
没有输出

但这确实:

sqlite> select name,country from students where name GLOB '^[A-za-z]*a$';
为什么??我知道在这种情况下,使用“^$”作为名称是多余的,但只是出于好奇。

GLOB运算符…使用Unix文件globbing语法作为其通配符

Unix文件全局搜索语法不使用
^
/
$


GLOB始终匹配整个字符串,因此这些边界标记没有意义。

您标记了regex,但我相信您处理的是GLOB。这两个是非常不同的。(我不认为大多数glob系统支持
^
$
)几乎没有关于sqlite glob的文档,所以也许你是对的。是的,glob使用普通的shell通配符匹配模式。fwiw,你的多余注释是一个关键点,因为我认为任何glob中都隐含着regex
^$
符号。正则表达式
a
(在任何地方查找
a
)必须使用glob系统编写
*a*
sqlite> select name,country from students where name GLOB '[A-za-z]*a';
name        country   
----------  ----------
Sara        usa       
Jena        usa