gpt4 book ai didi

正则表达式过滤结果sqlite

转载 作者:搜寻专家 更新时间:2023-10-30 23:10:28 25 4
gpt4 key购买 nike

我在名为 file_path 的 sql lite 表中有数据,如下所示

full_path
---------
H:\new.docx
H:\outer
H:\outer\inner1
H:\outer\inner2
H:\outer\inner1\inner12
H:\new.docx
H:\outer\in1.pdf
H:\outer\inner1\in11.jpg
H:\outer\inner1\inner12\in121.wma
H:\new1.doc
H:\new2.rtf
H:\new.txt

我想获取“H”的直接子行意味着我不想要文件夹内的文件/文件夹。是否可以使用正则表达式?

最佳答案

您将查找以 h: 开头但仅包含一个 \ 字符(无子文件夹)的行。

所以:

select * from file_path where 
(full_path like 'h:%') and
not (full_path like '%\%\%');

关于正则表达式过滤结果sqlite,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21153072/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com