searching with YUM
You generally don't use any regular expressions (globs) when searching with yum search
since the command search
is already looking for sub-strings within the package names and their summaries. How do I know this? There's a message that tells you this when you use yum search
.
Name and summary matches only, use "search all" for everything.
NOTE: The string [cl-*]
is technically a glob in the Bash shell.
So you generally look for fragments of strings that you want with search
. The regular expressions come into play when you're looking for particular packages. These are the YUM commands like list
and install
.
For example:
$ yum list cl-* | expand
Loaded plugins: fastestmirror, langpacks, refresh-packagekit, tsflags
Loading mirror speeds from cached hostfile
* fedora: mirror.dmacc.net
* rpmfusion-free: mirror.nexcess.net
* rpmfusion-free-updates: mirror.nexcess.net
* rpmfusion-nonfree: mirror.nexcess.net
* rpmfusion-nonfree-updates: mirror.nexcess.net
* updates: mirror.dmacc.net
Available Packages
cl-asdf.noarch 20101028-5.fc19 fedora
cl-clx.noarch 0.7.4-4.3 home_zhonghuaren
cl-ppcre.noarch 2.0.3-3.3 home_zhonghuaren
The only caveat you have to be careful with regexes/globs, is if there are files within your shell that are named such that they too would matchcl-*
. In those cases your shell will expand the regex/glob prior to it being presented to YUM.
So instead of running yum list cl-*
you'll be running the command yum list cl-file
, if there's a file matching the regex/glob cl-*
.
For example:
$ ls cl-file
cl-file
$ yum list cl-*
Loaded plugins: fastestmirror, langpacks, refresh-packagekit, tsflags
Loading mirror speeds from cached hostfile
* fedora: mirror.steadfast.net
* rpmfusion-free: mirror.nexcess.net
* rpmfusion-free-updates: mirror.nexcess.net
* rpmfusion-nonfree: mirror.nexcess.net
* rpmfusion-nonfree-updates: mirror.nexcess.net
* updates: mirror.steadfast.net
Error: No matching Packages to list
You can guard against this happening by escaping the wildcard like so:
$ yum list cl-\* | expand
Loaded plugins: fastestmirror, langpacks, refresh-packagekit, tsflags
Loading mirror speeds from cached hostfile
* fedora: mirror.dmacc.net
* rpmfusion-free: mirror.nexcess.net
* rpmfusion-free-updates: mirror.nexcess.net
* rpmfusion-nonfree: mirror.nexcess.net
* rpmfusion-nonfree-updates: mirror.nexcess.net
* updates: mirror.dmacc.net
Available Packages
cl-asdf.noarch 20101028-5.fc19 fedora
cl-clx.noarch 0.7.4-4.3 home_zhonghuaren
cl-ppcre.noarch 2.0.3-3.3 home_zhonghuaren
So what about the brackets
I suspect you have files in your local directory that are getting matched when you used [cl-*]
as an argument to yum search
. These files after being matched by the shell, were passed to the yum search
command where matches where then found.
For example:
$ ls cl-file
cl-file
$ yum search cl-*
Loaded plugins: fastestmirror, langpacks, refresh-packagekit, tsflags
Loading mirror speeds from cached hostfile
* fedora: mirror.dmacc.net
* rpmfusion-free: mirror.nexcess.net
* rpmfusion-free-updates: mirror.nexcess.net
* rpmfusion-nonfree: mirror.nexcess.net
* rpmfusion-nonfree-updates: mirror.nexcess.net
* updates: mirror.dmacc.net
======================================================================= N/S matched: cl-file =======================================================================
opencl-filesystem.noarch : OpenCL filesystem layout
Name and summary matches only, use "search all" for everything.
NOTE: The match above was matched against my file's name, cl-file
, and not the cl-*
as I had intended.
When man's output passes through more, each bold character is in fact that character, followed by a backspace, followed by repeating that character and then to the next character. To find something in bold, search for /^H..I..S..T
You'll find it also in the article Stéphane pointed to.
Best Answer
If you’re referring to a
less
binary,less --version
will tell you which regex implementation it’s using; for exampleAt build time, the library is determined by the
--with-regex
given to./configure
:and traced in the build logs.
Some of the implementations are available as separate libraries (
pcre
for example), others are included in the C library (gnu
for example), one of them is included in theless
source code (regcomp-local
).I think the expression refers to whichever library was available on the system
less
was built on, in the context of theauto
option at least. Once built, a givenless
binary won’t change its regex implementation.None.
The supported libraries are:
regcomp
(identified as “POSIX” in the version string);re_compile_pattern
(“GNU”);regcmp
(“V8”);regcomp
, either provided by the system orless
’ own copy (Henry Spencer’s implementation; “Spencer V8”);re_comp
(“BSD”).