ScottPletcher (7/31/2015)
halifaxdal (7/31/2015)
Can you explain '%[a-z]:%\%.%'? My first time to use it, thanks. Basically the sample data is sample only, the real data could be randomly and I have no idea what that could be, but still need to filter to exclude those non-fileSure.
'%[a-z]:%\%.%'
% = any character(s), or none at all. So LIKE '%' would match anything.
[a-z] = a character from a to z, that is, any letter
: = exactly a colon
% = again, any character(s), or none at all
\ = exactly a backslash
% = "
. = exactly a dot
% = "
So, to put it all together, to be included in the result, the string must have:
a letter &
followed immediately by : &
followed by \ after any number of chars &
followed by . after any number of chars
Thus, these strings would match:
c:\emp\abc.1
d:\abc.template
user:\file1.ext --tricky, but r: is a letter directly followed by a colon, with ANY char(s) before it
If you want to prevent this last match, you'll need two separate conditions:
LIKE '[a-z]:%\%.%' --meaning the string must start with a letter and a colon,
OR LIKE '%[^a-z][a-z]:%\%.%' --meaning anywhere in the char immediately before the letter: must NOT be a-z
Thanks Scott, I understand now.