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-X的小人(1)前端
- jed-extra-有用的Jed模式和实用程序的集合
我对POSIX.2正则表达式模式的初步了解认为原子(^ man)只能与行首的字符串“ man”相匹配。显然,上述行在行开始处没有“ man”。为什么将它们打印到我的终端上?
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 withman
, and bothgman
andjed-extra
haveman-browser
as a provided package name (you can see this withapt-cache show
).