Skip to content

sheran/pcre2-zig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Using the PCRE2 C Library with Zig

Zig Version Used : 0.14.0-dev.1550+4fba7336a

I wanted to have regular expressions in my Zig program because reasons. Instead of using regex.h, I decided to go with PCRE. I started by using the demo C code on the PCRE website which you will find in the /src directory.

From there, I re-wrote the C code in Zig and discovered some quirks with how Zig interprets C macros. I go into more detail here.

How to test

Clone the repo and then do zig build run to get results. You can change the pattern and the subject in the code. Note that you can only test UTF-8 strings at the moment.

What good is this?

Consider this repo more as a reference than anything else. There is a lot more testing that needs to be done. It will be interesting to match a few of the go Regexp APIs.

Pull requests always welcome.

About

An example for using the PCRE2 C library from Zig

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors