miniexpect: Tiny “expect” library in 500 LoC
miniexpect is a very simple expect-like library

It has a saner interface than libexpect, and doesn't depend on Tcl.
It is also thread safe, const-correct and uses modern C standards.

It is standalone, except that it requires the PCRE2 (Perl Compatible
Regular Expressions) library from  The PCRE2
dependency is fundamental because we want to offer the most powerful
regular expression syntax to match on, but more importantly because
PCRE2 has a convenient way to detect partial matches which made this
library very simple to implement.


The library was written by Richard W.M. Jones 
and is licensed under the Library GPL (LGPL) version 2 or above.

Source is available from:;a=summary

Using the library

If you wanted to copy the library into your own code (instead of
linking to it as a dependency), you only need to copy the two files:
miniexpect.h, miniexpect.c.

The API is documented in the manual page (miniexpect.pod / miniexpect.3).

For examples of how to use the API in reality, see the examples and
tests in the source directory.