pkg-info: supplying word boundary in regex

parv at pair.com parv at pair.com
Mon Jan 12 15:51:36 UTC 2015


(Running pkg 1.4.4 on FreeBSD 8-STABLE here.)

Could somebody tell me please the syntax for word boundary in regex
for pkg-info ...

  pkg info -x '...'


... ?

The pkg-info manual page says ...

  -x, --regex
    Treat pkg-name as a regular expression according to the "modern"
    or "extended" syntax of re_format(7).

... and re_format man page says ...

  There are two special cases= of bracket expressions: the bracket
  expressions `[[:<:]]' and `[[:>:]]' match the null string at the
  beginning and end of a word respectively.  A word is defined as a
  sequence of word characters which is neither preceded nor followed
  by word characters.  A word character is an alnum character (as
  defined by ctype(3)) or an underscore.

... then specifying a word boundary as "x[[:>:]]" (to match "x" at the
end of a "word") causes "Invalid regex" error. For example, to get
result only for "tex" (avoiding packages with "text" as string in a
package name[0]) ...

   # pkg info -x 'tex[[:>:]]'
   pkg: sqlite error while executing iterator in file \
   pkgdb_iterator.c:905: Invalid regex


Does pkg overstate its support for re_format(7) then?


  - parv


  [0] Yes, I realize if a name happens to be "text-tex" I would also
      get a result & that would be expected. Common case is that
      packages here have only either "text" or "tex" exclusively in
      the name.

-- 



More information about the freebsd-questions mailing list