3

I need to perform package name search with nala and I want only exact matches, so basically, when searching for package gimp I want to obtain only gimp but not gimp-data.

Input:

apt search -n ^gimp$

Result:

Sorting... Done
Full Text Search... Done
gimp/jammy,now 2.10.30-1build1 amd64 [installed]
  GNU Image Manipulation Program

Input:

nala search -n ^gimp$

Result:

Error: ^gimp$ not found.
3
  • Which version of nala are you using? Feb 5 at 9:44
  • @ArturMeinild 0.11.1~bpo22.04.1.
    – Harry
    Feb 5 at 10:15
  • Ok - see my answer below. Feb 5 at 10:37

1 Answer 1

2

There was done a lot for the search part in the recent nala releases.

Version 0.12.0 fixed the end-of-text RegEx search pattern:

Search end-of-text regexp not finding matches

So if you update to this version or later, the query returns the expected results (here done for apt):

$ nala search -n ^apt$
apt 2.4.8 [Ubuntu/jammy main]
├── is installed
└── commandline package manager

For packages in the universe repository, make sure this is enabled, to be able to find packages included here. You then get the expected result for gimp as well:

$ nala search -n ^gimp$
gimp 2.10.30-1build1 [Ubuntu/jammy universe]
└── GNU Image Manipulation Program

For the RegEx explained, the character ^ indicates the beginning of the line and $ indicates the end of the line.

  • The search ^something$ will return something only.
  • The search ^something will return all matches that begin with something
  • The search something$ will return all matches that end with something
2
  • 1
    "Latest version" is 0.12.1, looks from the changelogs like this was fixed in 0.12.0?
    – pbhj
    Feb 5 at 9:57
  • 1
    You're right ! 👍 Feb 5 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.