Regex 用于过滤sqlite结果的正则表达式
我在SQLLite表中有一个名为file_path的数据,如下所示Regex 用于过滤sqlite结果的正则表达式,regex,database,sqlite,Regex,Database,Sqlite,我在SQLLite表中有一个名为file_path的数据,如下所示 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.
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”的直接子行,这意味着我不想要文件夹中的文件/文件夹。是否可以使用regex?您可以查找以
h:
开头但仅包含一个\
字符(无子文件夹)的行
因此:
这真是一个简单而愚蠢的解决方案…伟大的工作伙伴。。谢谢你,保罗,这条斜线正在制造问题。。。你能指导我解决它吗。。。有没有办法在不使用转义符的情况下强制进行字符串比较。
select * from file_path where
(full_path like 'h:%') and
not (full_path like '%\%\%');