Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Jan 2015 05:40:38 -1000
From:      parv@pair.com
To:        f-q <freebsd-questions@freebsd.org>
Subject:   pkg-info: supplying word boundary in regex
Message-ID:  <20150112154038.GA41662@holstein.holy.cow>

next in thread | raw e-mail | index | archive | help
(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.

-- 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150112154038.GA41662>