nimpcre

PCRE wrapper for Nim

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version Unknown
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:24

Tags

Installation

nimble install nimpcre
choosenim install nimpcre
git clone https://github.com/genotrance/nimpcre

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
nimpcre - - - - - - -

Source

Repository https://github.com/genotrance/nimpcre
Homepage https://github.com/genotrance/nimpcre
Registry Source nimble_official

README

Nimpcre is a Nim wrapper for the PCRE library.

While PCRE is already available within Nim, this module makes it easy to statically compile PCRE into the resulting binary instead of relying on an external DLL or binary.

Nimpcre is distributed as a Nimble package and depends on nimterop.

Installation

Nimpcre can be installed via Nimble:

> nimble install nimpcre

This will download and install nimpcre in the standard Nimble package location, typically ~/.nimble. Once installed, it can be imported into any Nim program.

import nimpcre

import re

echo "abc".match(re"a.+")

NOTE: The -d:usePcreHeader flag needs to be specified to the Nim compiler in order to remove the dependency on the external DLL. This can also be accomplished by using a nim.cfg or test.cfg in the same directory as the code being compiled.

On Windows, building PCRE will be simpler with cmake which can be installed with nimble install cmake. This will download and shim the cmake executable for convenience. Without cmake, the autotools suite will be needed since PCRE does not ship with a ready configure script. This will require a full MSYS setup.

cmake on Windows also requires a working bash which is already shipped with git. However, git is typically installed in Program Files and has a space in the path which breaks cmake. A workaround is to have git installed to another path.

nim c -d:usePcreHeader -r test.nim

Credits

Nimpcre wraps the PCRE source code and all licensing terms of PCRE apply to the usage of this package.

Feedback

Nimpcre is a work in progress and any feedback or suggestions are welcome. It is hosted on GitHub with an MIT license so issues, forks and PRs are most appreciated.