What kind of pattern matching does apt-cache allow for specifying package names?
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
The question is about apt-cache
commands other than search regex
.
I know I can use a star character as a wildcard, for example apt-cache policy 'firefox*'
, but I could not find any documentation on what else is possible. Is it the same as filename expansion? Does something like extglob
switch exist for it?
The actual problem i'm trying to solve is to have apt-cache policy
show me everything 'firefox*'
except all the -l10n-
packages.
apt
add a comment |
The question is about apt-cache
commands other than search regex
.
I know I can use a star character as a wildcard, for example apt-cache policy 'firefox*'
, but I could not find any documentation on what else is possible. Is it the same as filename expansion? Does something like extglob
switch exist for it?
The actual problem i'm trying to solve is to have apt-cache policy
show me everything 'firefox*'
except all the -l10n-
packages.
apt
add a comment |
The question is about apt-cache
commands other than search regex
.
I know I can use a star character as a wildcard, for example apt-cache policy 'firefox*'
, but I could not find any documentation on what else is possible. Is it the same as filename expansion? Does something like extglob
switch exist for it?
The actual problem i'm trying to solve is to have apt-cache policy
show me everything 'firefox*'
except all the -l10n-
packages.
apt
The question is about apt-cache
commands other than search regex
.
I know I can use a star character as a wildcard, for example apt-cache policy 'firefox*'
, but I could not find any documentation on what else is possible. Is it the same as filename expansion? Does something like extglob
switch exist for it?
The actual problem i'm trying to solve is to have apt-cache policy
show me everything 'firefox*'
except all the -l10n-
packages.
apt
apt
edited Mar 18 at 8:18
Rui F Ribeiro
42.1k1484142
42.1k1484142
asked Mar 18 at 6:30
ultracrepidarianultracrepidarian
1386
1386
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Package names are handled as described in the documentation for apt-get install
(yes, it’s not obvious):
If no package matches the given expression and the expression contains one of '.', '?' or '*' then it is assumed to be a POSIX regular expression, and it is applied to all package names in the database. Any matches are then installed (or removed). Note that matching is done by substring so 'lo.*' matches 'how-lo' and 'lowest'. If this is undesired, anchor the regular expression with a '^' or '$' character, or create a more specific regular expression.
Strictly speaking, this check comes after a glob performed on the available package names — so package specifications are first checked for an exact match, then checked for glob matches (using ?
and *
), and if that doesn’t find anything, and the package specification contains .
, ?
, or *
, interpreted as regular expressions. (You can see the globbing behaviour by running apt-cache policy 'firefo?'
, which matches using only a glob, and then apt-cache policy 'firefox?'
, which ends up using a regular expression.)
apt-cache policy 'firefox*'
matches using globs. If you want to force it to match using a regular expression, you can use something like apt-cache policy 'firefox.*'
instead; check for mozilla-firefox
in the output to see if the expression is matched as a glob or as a regular expression.
apt-cache search
is documented explicitly as handling regular expressions because its arguments are always treated as regular expressions.
Given the kind of regular expressions apt
supports, excluding -l10n-
is probably impossible; see this SO answer for details.
Ifpkg
can be interpreted as RE, then why does documentation (man apt-cache
) distinguish between search (search regex...
) and all other commands (e.g.policy [pkg...]
)?
– ultracrepidarian
Mar 18 at 8:14
Regarding-l10n-
, I do see them as well. I don't want to see them. And I'm already single-quoting the name,'firefox*'
.
– ultracrepidarian
Mar 18 at 8:17
Oh, I had misunderstood, sorry. See my update.
– Stephen Kitt
Mar 18 at 8:35
Would this not be a 100% correct way to exclude packages containingl10n
:apt-cache policy 'firefox([^l]|l[^1]|l1[^0]|l10[^n])*$'
?
– ultracrepidarian
Mar 18 at 9:18
No, that also excludes packages ending withl
, such asfirefox-certificatepatrol
,firefox-form-history-control
...
– Stephen Kitt
Mar 18 at 9:33
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f506921%2fwhat-kind-of-pattern-matching-does-apt-cache-allow-for-specifying-package-names%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Package names are handled as described in the documentation for apt-get install
(yes, it’s not obvious):
If no package matches the given expression and the expression contains one of '.', '?' or '*' then it is assumed to be a POSIX regular expression, and it is applied to all package names in the database. Any matches are then installed (or removed). Note that matching is done by substring so 'lo.*' matches 'how-lo' and 'lowest'. If this is undesired, anchor the regular expression with a '^' or '$' character, or create a more specific regular expression.
Strictly speaking, this check comes after a glob performed on the available package names — so package specifications are first checked for an exact match, then checked for glob matches (using ?
and *
), and if that doesn’t find anything, and the package specification contains .
, ?
, or *
, interpreted as regular expressions. (You can see the globbing behaviour by running apt-cache policy 'firefo?'
, which matches using only a glob, and then apt-cache policy 'firefox?'
, which ends up using a regular expression.)
apt-cache policy 'firefox*'
matches using globs. If you want to force it to match using a regular expression, you can use something like apt-cache policy 'firefox.*'
instead; check for mozilla-firefox
in the output to see if the expression is matched as a glob or as a regular expression.
apt-cache search
is documented explicitly as handling regular expressions because its arguments are always treated as regular expressions.
Given the kind of regular expressions apt
supports, excluding -l10n-
is probably impossible; see this SO answer for details.
Ifpkg
can be interpreted as RE, then why does documentation (man apt-cache
) distinguish between search (search regex...
) and all other commands (e.g.policy [pkg...]
)?
– ultracrepidarian
Mar 18 at 8:14
Regarding-l10n-
, I do see them as well. I don't want to see them. And I'm already single-quoting the name,'firefox*'
.
– ultracrepidarian
Mar 18 at 8:17
Oh, I had misunderstood, sorry. See my update.
– Stephen Kitt
Mar 18 at 8:35
Would this not be a 100% correct way to exclude packages containingl10n
:apt-cache policy 'firefox([^l]|l[^1]|l1[^0]|l10[^n])*$'
?
– ultracrepidarian
Mar 18 at 9:18
No, that also excludes packages ending withl
, such asfirefox-certificatepatrol
,firefox-form-history-control
...
– Stephen Kitt
Mar 18 at 9:33
add a comment |
Package names are handled as described in the documentation for apt-get install
(yes, it’s not obvious):
If no package matches the given expression and the expression contains one of '.', '?' or '*' then it is assumed to be a POSIX regular expression, and it is applied to all package names in the database. Any matches are then installed (or removed). Note that matching is done by substring so 'lo.*' matches 'how-lo' and 'lowest'. If this is undesired, anchor the regular expression with a '^' or '$' character, or create a more specific regular expression.
Strictly speaking, this check comes after a glob performed on the available package names — so package specifications are first checked for an exact match, then checked for glob matches (using ?
and *
), and if that doesn’t find anything, and the package specification contains .
, ?
, or *
, interpreted as regular expressions. (You can see the globbing behaviour by running apt-cache policy 'firefo?'
, which matches using only a glob, and then apt-cache policy 'firefox?'
, which ends up using a regular expression.)
apt-cache policy 'firefox*'
matches using globs. If you want to force it to match using a regular expression, you can use something like apt-cache policy 'firefox.*'
instead; check for mozilla-firefox
in the output to see if the expression is matched as a glob or as a regular expression.
apt-cache search
is documented explicitly as handling regular expressions because its arguments are always treated as regular expressions.
Given the kind of regular expressions apt
supports, excluding -l10n-
is probably impossible; see this SO answer for details.
Ifpkg
can be interpreted as RE, then why does documentation (man apt-cache
) distinguish between search (search regex...
) and all other commands (e.g.policy [pkg...]
)?
– ultracrepidarian
Mar 18 at 8:14
Regarding-l10n-
, I do see them as well. I don't want to see them. And I'm already single-quoting the name,'firefox*'
.
– ultracrepidarian
Mar 18 at 8:17
Oh, I had misunderstood, sorry. See my update.
– Stephen Kitt
Mar 18 at 8:35
Would this not be a 100% correct way to exclude packages containingl10n
:apt-cache policy 'firefox([^l]|l[^1]|l1[^0]|l10[^n])*$'
?
– ultracrepidarian
Mar 18 at 9:18
No, that also excludes packages ending withl
, such asfirefox-certificatepatrol
,firefox-form-history-control
...
– Stephen Kitt
Mar 18 at 9:33
add a comment |
Package names are handled as described in the documentation for apt-get install
(yes, it’s not obvious):
If no package matches the given expression and the expression contains one of '.', '?' or '*' then it is assumed to be a POSIX regular expression, and it is applied to all package names in the database. Any matches are then installed (or removed). Note that matching is done by substring so 'lo.*' matches 'how-lo' and 'lowest'. If this is undesired, anchor the regular expression with a '^' or '$' character, or create a more specific regular expression.
Strictly speaking, this check comes after a glob performed on the available package names — so package specifications are first checked for an exact match, then checked for glob matches (using ?
and *
), and if that doesn’t find anything, and the package specification contains .
, ?
, or *
, interpreted as regular expressions. (You can see the globbing behaviour by running apt-cache policy 'firefo?'
, which matches using only a glob, and then apt-cache policy 'firefox?'
, which ends up using a regular expression.)
apt-cache policy 'firefox*'
matches using globs. If you want to force it to match using a regular expression, you can use something like apt-cache policy 'firefox.*'
instead; check for mozilla-firefox
in the output to see if the expression is matched as a glob or as a regular expression.
apt-cache search
is documented explicitly as handling regular expressions because its arguments are always treated as regular expressions.
Given the kind of regular expressions apt
supports, excluding -l10n-
is probably impossible; see this SO answer for details.
Package names are handled as described in the documentation for apt-get install
(yes, it’s not obvious):
If no package matches the given expression and the expression contains one of '.', '?' or '*' then it is assumed to be a POSIX regular expression, and it is applied to all package names in the database. Any matches are then installed (or removed). Note that matching is done by substring so 'lo.*' matches 'how-lo' and 'lowest'. If this is undesired, anchor the regular expression with a '^' or '$' character, or create a more specific regular expression.
Strictly speaking, this check comes after a glob performed on the available package names — so package specifications are first checked for an exact match, then checked for glob matches (using ?
and *
), and if that doesn’t find anything, and the package specification contains .
, ?
, or *
, interpreted as regular expressions. (You can see the globbing behaviour by running apt-cache policy 'firefo?'
, which matches using only a glob, and then apt-cache policy 'firefox?'
, which ends up using a regular expression.)
apt-cache policy 'firefox*'
matches using globs. If you want to force it to match using a regular expression, you can use something like apt-cache policy 'firefox.*'
instead; check for mozilla-firefox
in the output to see if the expression is matched as a glob or as a regular expression.
apt-cache search
is documented explicitly as handling regular expressions because its arguments are always treated as regular expressions.
Given the kind of regular expressions apt
supports, excluding -l10n-
is probably impossible; see this SO answer for details.
edited Mar 18 at 9:35
answered Mar 18 at 7:48
Stephen KittStephen Kitt
182k25415494
182k25415494
Ifpkg
can be interpreted as RE, then why does documentation (man apt-cache
) distinguish between search (search regex...
) and all other commands (e.g.policy [pkg...]
)?
– ultracrepidarian
Mar 18 at 8:14
Regarding-l10n-
, I do see them as well. I don't want to see them. And I'm already single-quoting the name,'firefox*'
.
– ultracrepidarian
Mar 18 at 8:17
Oh, I had misunderstood, sorry. See my update.
– Stephen Kitt
Mar 18 at 8:35
Would this not be a 100% correct way to exclude packages containingl10n
:apt-cache policy 'firefox([^l]|l[^1]|l1[^0]|l10[^n])*$'
?
– ultracrepidarian
Mar 18 at 9:18
No, that also excludes packages ending withl
, such asfirefox-certificatepatrol
,firefox-form-history-control
...
– Stephen Kitt
Mar 18 at 9:33
add a comment |
Ifpkg
can be interpreted as RE, then why does documentation (man apt-cache
) distinguish between search (search regex...
) and all other commands (e.g.policy [pkg...]
)?
– ultracrepidarian
Mar 18 at 8:14
Regarding-l10n-
, I do see them as well. I don't want to see them. And I'm already single-quoting the name,'firefox*'
.
– ultracrepidarian
Mar 18 at 8:17
Oh, I had misunderstood, sorry. See my update.
– Stephen Kitt
Mar 18 at 8:35
Would this not be a 100% correct way to exclude packages containingl10n
:apt-cache policy 'firefox([^l]|l[^1]|l1[^0]|l10[^n])*$'
?
– ultracrepidarian
Mar 18 at 9:18
No, that also excludes packages ending withl
, such asfirefox-certificatepatrol
,firefox-form-history-control
...
– Stephen Kitt
Mar 18 at 9:33
If
pkg
can be interpreted as RE, then why does documentation (man apt-cache
) distinguish between search (search regex...
) and all other commands (e.g. policy [pkg...]
)?– ultracrepidarian
Mar 18 at 8:14
If
pkg
can be interpreted as RE, then why does documentation (man apt-cache
) distinguish between search (search regex...
) and all other commands (e.g. policy [pkg...]
)?– ultracrepidarian
Mar 18 at 8:14
Regarding
-l10n-
, I do see them as well. I don't want to see them. And I'm already single-quoting the name, 'firefox*'
.– ultracrepidarian
Mar 18 at 8:17
Regarding
-l10n-
, I do see them as well. I don't want to see them. And I'm already single-quoting the name, 'firefox*'
.– ultracrepidarian
Mar 18 at 8:17
Oh, I had misunderstood, sorry. See my update.
– Stephen Kitt
Mar 18 at 8:35
Oh, I had misunderstood, sorry. See my update.
– Stephen Kitt
Mar 18 at 8:35
Would this not be a 100% correct way to exclude packages containing
l10n
: apt-cache policy 'firefox([^l]|l[^1]|l1[^0]|l10[^n])*$'
?– ultracrepidarian
Mar 18 at 9:18
Would this not be a 100% correct way to exclude packages containing
l10n
: apt-cache policy 'firefox([^l]|l[^1]|l1[^0]|l10[^n])*$'
?– ultracrepidarian
Mar 18 at 9:18
No, that also excludes packages ending with
l
, such as firefox-certificatepatrol
, firefox-form-history-control
...– Stephen Kitt
Mar 18 at 9:33
No, that also excludes packages ending with
l
, such as firefox-certificatepatrol
, firefox-form-history-control
...– Stephen Kitt
Mar 18 at 9:33
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f506921%2fwhat-kind-of-pattern-matching-does-apt-cache-allow-for-specifying-package-names%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown