Reputation: 507
I have data in sql lite table called file_path like following
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
I want to get the rows which are direct child of "H" means I do not want files/folders which are inside a folder. Is it possible using regex?
Upvotes: 1
Views: 112
Reputation: 36438
You'd look for rows that start with h:
, but contain only one \
character (no subfolders).
So:
select * from file_path where
(full_path like 'h:%') and
not (full_path like '%\%\%');
Upvotes: 2