高效搜索之“与”“或”
技巧:在Everything的搜索框中可以输入多个关键词,以空格分开,表示搜索结果要包括全部关键词。大家肯定对这种做法不会陌生,因为它正是搜索引擎的惯例。

举例:键入(不包括引号,下同)“李白 北京 08 jpg”,可以快速找出某些照片。

技巧:对应“与”的还有“或”(OR)运算,用半角竖线表示:|。当你不确信关键词的准确描述时,这种方式非常有用。

举例:“jpg 李白|libai 北京 08”、“免费|freeware”……

引伸:既然空格表示“与”,那么如何表示真正的空格呢?很简单,加英文半角引号,比如”program files”。

 

Using a * in your search will match any number of any type of character.
For example, here's how to search for files and folders that start with e and end with g: e*g
在搜索时使用*可以匹配任何数量的任何字符。
例如,使用e*g可以搜索到任何以e开头,以g结尾的文件和文件夹。

Using a ? in your search will match one character.
For example, here's how to search for files that have a 2 letter file extension: *.??
使用半角?号可以匹配任意单个字符。
例如,可以使用*.??来搜索后缀名为2个字符的文件。注意到,通配符*.??与正则式的原理是不一样的。

通配符??精确地匹配2位字符,但是如果是正则式的话,还需要有一个结尾的$来保证这一点,呵呵。

 

How do I use regex?

  • | A vertical bar separates alternatives. For example, gray|grey can match "gray" or "grey".
  • 竖线用来分隔备选项。例如,gray|grey 可以匹配"gray" 或 "grey"
  • () Parentheses are used to define the scope and precedence of the operators (among other uses). For example, gray|grey and gr(a|e)y are equivalent patterns which both describe the set of "gray" and "grey".
    括号用来界定范围和操作符的优先权。例如,gray|grey 与 gr(a|e)y 两种模式的效果是相同的,都是用来描述"gray"与"grey"两种匹配项。
  • ? The question mark indicates there is zero or one of the preceding element. For example, colou?r matches both "color" and "colour".
    问号表示之前的元素可以出现0次或1次。例如,colou?r 匹配 "color" 和 "colour".
  • * The asterisk indicates there are zero or more of the preceding element. For example, ab*c matches "ac", "abc", "abbc", "abbbc", and so on.
    星号表示之前的元素可以出现0次或任意多次。例如,ab*c 匹配 "ac", "abc", "abbc", "abbbc", 诸如此类。
  • + The plus sign indicates that there is one or more of the preceding element. For example, ab+c matches "abc", "abbc", "abbbc", and so on, but not "ac".
    加号表示之前的元素可以出现1次或更多次。例如,ab+c 匹配 "abc", "abbc", "abbc", "abbbc", 诸如此类,但是不匹配"ac"。
  • . Matches any single character except newlines (exactly which characters are considered newlines is flavor, character encoding, and platform specific, but it is safe to assume that the line feed character is included). Within POSIX bracket expressions, the dot character matches a literal dot. For example, a.c matches "abc", etc., but [a.c] matches only "a", ".", or "c".
    点号匹配除新行符之外的任何一位字符(精确地说,至于哪种字符是换行符,这要取决于正则式风格,字符编码系统,以及所使用的操作系统,但是,将换行符包括进来是无伤大雅的)。在POSIX风格的方括号表达式中,点号匹配普通文本‘.’,例如,a.c匹配"abc"等文本,但是,[a.c]只匹配'a','.',或'c'。
  • [ ] A bracket expression. Matches a single character that is contained within the brackets. For example, [abc] matches "a", "b", or "c". [a-z] specifies a range which matches any lowercase letter from "a" to "z". These forms can be mixed: [abcx-z] matches "a", "b", "c", "x", "y", and "z", as does [a-cx-z]
    方括号表达式匹配在其内部的任意一位字符。例如,[abc]匹配"a","b"或"c"。[a-z]匹配从a至z的区间内任意一位小写字母。这两种方式可以混合使用,例如,[abcx-z] 匹配 "a", "b", "c", "x", "y", 和 "z";与 [a-cx-z]的作用一样。
  • [^ ] Matches a single character that is not contained within the brackets. For example, [^abc] matches any character other than "a", "b", or "c". [^a-z] matches any single character that is not a lowercase letter from "a" to "z". As above, literal characters and ranges can be mixed.
    匹配任何不在方括号内的字符。例如,[^abc]匹配除"a", "b", "c"之外的任何一位字符。[^a-z] 匹配任何不在小写字母a至z区间内的字符。与上一条类似,普通文本可以和区间符-混合使用。
  • ^ Matches the starting position within the string. In line-based tools, it matches the starting position of any line.
    ^匹配文本行开头的位置。注意,是位置,而不是具体字符。在以“行”为单位处理文本的工具中,它匹配任何一行的开始位置。
  • $ Matches the ending position of the string or the position just before a string-ending newline. In line-based tools, it matches the ending position of any line.
    作用与^相反,它匹配文本行的结尾,下一行文本之前的位置。在以“行”为单位处理文本的工具中,它匹配任何一行的结尾位置。
  • {m,n} Matches the preceding element at least m and not more than n times. For example, a{3,5} matches only "aaa", "aaaa", and "aaaaa". This is not found in a few, older instances of regular expressions.
    与*,+一样,{m,n}属于量词,用来限定匹配的次数。{m,n}匹配之前元素至少m次,至多n次。例如,a{3,5}只匹配"aaa", "aaaa", 和 "aaaaa"。本特性在少数旧式正则表达式中不被支持。
    How do I use regex?
  • | A vertical bar separates alternatives. For example, gray|grey can match "gray" or "grey".
  • 竖线用来分隔备选项。例如,gray|grey 可以匹配"gray" 或 "grey"
  • () Parentheses are used to define the scope and precedence of the operators (among other uses). For example, gray|grey and gr(a|e)y are equivalent patterns which both describe the set of "gray" and "grey".
    括号用来界定范围和操作符的优先权。例如,gray|grey 与 gr(a|e)y 两种模式的效果是相同的,都是用来描述"gray"与"grey"两种匹配项。
  • ? The question mark indicates there is zero or one of the preceding element. For example, colou?r matches both "color" and "colour".
    问号表示之前的元素可以出现0次或1次。例如,colou?r 匹配 "color" 和 "colour".
  • * The asterisk indicates there are zero or more of the preceding element. For example, ab*c matches "ac", "abc", "abbc", "abbbc", and so on.
    星号表示之前的元素可以出现0次或任意多次。例如,ab*c 匹配 "ac", "abc", "abbc", "abbbc", 诸如此类。
  • + The plus sign indicates that there is one or more of the preceding element. For example, ab+c matches "abc", "abbc", "abbbc", and so on, but not "ac".
    加号表示之前的元素可以出现1次或更多次。例如,ab+c 匹配 "abc", "abbc", "abbc", "abbbc", 诸如此类,但是不匹配"ac"。
  • . Matches any single character except newlines (exactly which characters are considered newlines is flavor, character encoding, and platform specific, but it is safe to assume that the line feed character is included). Within POSIX bracket expressions, the dot character matches a literal dot. For example, a.c matches "abc", etc., but [a.c] matches only "a", ".", or "c".
    点号匹配除新行符之外的任何一位字符(精确地说,至于哪种字符是换行符,这要取决于正则式风格,字符编码系统,以及所使用的操作系统,但是,将换行符包括进来是无伤大雅的)。在POSIX风格的方括号表达式中,点号匹配普通文本‘.’,例如,a.c匹配"abc"等文本,但是,[a.c]只匹配'a','.',或'c'。
  • [ ] A bracket expression. Matches a single character that is contained within the brackets. For example, [abc] matches "a", "b", or "c". [a-z] specifies a range which matches any lowercase letter from "a" to "z". These forms can be mixed: [abcx-z] matches "a", "b", "c", "x", "y", and "z", as does [a-cx-z]
    方括号表达式匹配在其内部的任意一位字符。例如,[abc]匹配"a","b"或"c"。[a-z]匹配从a至z的区间内任意一位小写字母。这两种方式可以混合使用,例如,[abcx-z] 匹配 "a", "b", "c", "x", "y", 和 "z";与 [a-cx-z]的作用一样。
  • [^ ] Matches a single character that is not contained within the brackets. For example, [^abc] matches any character other than "a", "b", or "c". [^a-z] matches any single character that is not a lowercase letter from "a" to "z". As above, literal characters and ranges can be mixed.
    匹配任何不在方括号内的字符。例如,[^abc]匹配除"a", "b", "c"之外的任何一位字符。[^a-z] 匹配任何不在小写字母a至z区间内的字符。与上一条类似,普通文本可以和区间符-混合使用。
  • ^ Matches the starting position within the string. In line-based tools, it matches the starting position of any line.
    ^匹配文本行开头的位置。注意,是位置,而不是具体字符。在以“行”为单位处理文本的工具中,它匹配任何一行的开始位置。
  • $ Matches the ending position of the string or the position just before a string-ending newline. In line-based tools, it matches the ending position of any line.
    作用与^相反,它匹配文本行的结尾,下一行文本之前的位置。在以“行”为单位处理文本的工具中,它匹配任何一行的结尾位置。
  • {m,n} Matches the preceding element at least m and not more than n times. For example, a{3,5} matches only "aaa", "aaaa", and "aaaaa". This is not found in a few, older instances of regular expressions.
    与*,+一样,{m,n}属于量词,用来限定匹配的次数。{m,n}匹配之前元素至少m次,至多n次。例如,a{3,5}只匹配"aaa", "aaaa", 和 "aaaaa"。本特性在少数旧式正则表达式中不被支持。

支持正则表达式,快速,是我喜欢everything的最主要原因。用它来搜索文件名足够了。搜索文件内容的话,我们有PowerGREP。
我不喜欢everything的原因是,不支持fat分区格式。可以想见,在linux下,用wine启动everything,它也必定不支持ext[23]之类的分区格式。不过,在linux下,我们有ls -R * | grep 'pattern',呵呵。