What kind of pattern matching does apt-cache allow for specifying package names?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















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.










share|improve this question






























    1















    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.










    share|improve this question


























      1












      1








      1








      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.










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 18 at 8:18









      Rui F Ribeiro

      42.1k1484142




      42.1k1484142










      asked Mar 18 at 6:30









      ultracrepidarianultracrepidarian

      1386




      1386




















          1 Answer
          1






          active

          oldest

          votes


















          0














          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.






          share|improve this answer

























          • 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











          • 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











          • No, that also excludes packages ending with l, such as firefox-certificatepatrol, firefox-form-history-control...

            – Stephen Kitt
            Mar 18 at 9:33











          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
          );



          );













          draft saved

          draft discarded


















          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









          0














          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.






          share|improve this answer

























          • 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











          • 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











          • No, that also excludes packages ending with l, such as firefox-certificatepatrol, firefox-form-history-control...

            – Stephen Kitt
            Mar 18 at 9:33















          0














          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.






          share|improve this answer

























          • 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











          • 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











          • No, that also excludes packages ending with l, such as firefox-certificatepatrol, firefox-form-history-control...

            – Stephen Kitt
            Mar 18 at 9:33













          0












          0








          0







          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.






          share|improve this answer















          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.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 18 at 9:35

























          answered Mar 18 at 7:48









          Stephen KittStephen Kitt

          182k25415494




          182k25415494












          • 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











          • 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











          • No, that also excludes packages ending with l, such as firefox-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











          • 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 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
















          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

















          draft saved

          draft discarded
















































          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.




          draft saved


          draft discarded














          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





















































          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






          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay