Issue
If I open a Linux shell that uses an apt
package management system and execute apt-cache search --names-only "(^man)+"
why does it match/output things like:
- gman - small man(1) front-end for X
- jed-extra - collection of useful Jed modes and utilities
My nascent understanding of POSIX.2 regex patterns considered the atom (^man) to be something that would only match the string "man" right at the beginning of a line. Clearly, the aforementioned lines do not have "man" at line start. Why were they printed to my terminal?
Solution
man apt-cache
says --names-only
means "Only search on the package and provided package names". Your command will match any package where either the package name or a provided package name starts with man
, and both gman
and jed-extra
have man-browser
as a provided package name (you can see this with apt-cache show
).
Answered By - Joseph Sible-Reinstate Monica