pcre2test command not found

In this troubleshooting guide we learn how to fix pcre2test command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

pcre2test: command not found

or when using sudo you get the following error message

sudo: pcre2test: command not found

Solutions to pcre2test: command not found

How To Fix pcre2test: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu pcre2test is provided by pcre2-utils package.

pcre2-utils is:

This is PCRE2, the new implementation of PCRE, a library of functions to support regular expressions whose syntax and semantics are as close as possible to those of the Perl 5 language. New projects should use this library in preference to the older library, confusingly called pcre3 in Debian.

This package contains the utilities pcre2grep (like grep with PCRE) and pcre2test (a test program for the library, but also useful for experimenting with regular expressions). Both programs are also useful examples of programming with libpcre2.

To fix this problem, we can install more using the command below.

sudo apt-get -y install pcre2-utils

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install pcre2-utils.

sudo apt -y install pcre2-utils

Or if you have aptitude installed you can use the following command.

sudo aptitude install pcre2-utils

Summary

In this tutorial we learn how to fix pcre2test command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.