Searching for strings

Many search terms take a string as a parameter and match it against one or more fields of a package. Strings can be entered either with or without double quotes (「"」), so 「?name(scorch)」 and 「?name("scorch")」 will perform the same search.

If you enter a 「bare」 string, one not surrounded by double quotes, then aptitude will consider the string to have 「ended」 when it encounters the closing parenthesis or the comma before a second argument to the search term. [11] To remove the special meaning of these characters, place a tilde (「~」) directly before them. For instance, ?description(etc)) is a syntax error, because the first ) ends the ?description term, and the second ) does not match anything. In contrast, ?description(etc~)) matches any package whose description contains the text 「etc)」. There are additional considerations if you are using the shorthand notation for a term; see Shorthand for search terms項 for details.

テキスト検索 (パッケージの名前や説明などの検索) の多くは、大文字と小文字を区別しない正規表現を用いて実行されます。つまり、正規表現メタ文字[12]は検索時にバックスラッシュでエスケープしなければなりません (例えば、「g++」を見つけるにはパターン「g\+\+」を使用してください)。



[11] aptitude will only treat the comma as special if there is a second argument, so (for instance) 「?name(apt,itude)」 searches for the string 「apt,itude」 in the Name field of packages.

While this behavior is well-defined, it may be surprising; I recommend using quoted strings for any pattern that contains characters that could have a special meaning.

[12] 正規表現メタ文字とは、「+」・「-」・「.」・「(」・「)」・「|」・「[」・「]」・「^」・「$」・「?」です。これらの一部は aptitude のメタ文字でもあるので、(例えば) リテラル「|」を入力したい場合は「\~|」と二重にエスケープしなければいけないことに注意してください。