zig VS regex

Compare zig vs regex and see what are their differences.


General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software. (by ziglang)


An implementation of regular expressions for Rust. This implementation uses finite automata and guarantees linear time matching on all inputs. (by rust-lang)
Our great sponsors
  • SonarLint - Clean code begins in your IDE with SonarLint
  • Scout APM - Less time debugging, more time building
  • SaaSHub - Software Alternatives and Reviews
zig regex
456 46
16,826 2,388
15.0% 2.7%
10.0 8.0
6 days ago 15 days ago
Zig Rust
MIT License Apache License 2.0
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.


Posts with mentions or reviews of zig. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-08-14.
  • Will Bun JavaScript Take Node's Crown
    10 projects | news.ycombinator.com | 14 Aug 2022
    It really isn't that much different though. After skimming through the source code of Zig, you can see that well over 90% of the code is OS independent.

    Not only that, it looks like they do have windows support and it's just failing atm. It also looks like they have cleanly separated all OS functionality from the logic. This is where it looks like the majority of the OS dependent code lives[0], and the implementation for this is 1000 lines of code. So clearly, it looks like it shouldn't take more than a few hours to get even a programming language up and running when porting it.

    Further, it looks like they're using the cpp stdlib to assist with some OS dependent functions[1]. They're clearly using at least:

    * std filesystem

    * std future

    * std iostream

    * std mutex

    * std thread

    * std atomic

    And more. So if you're being smart about things, which it looks like the developers most certainly are, then you don't need to reinvent 90% of the OS dependent code and can instead use the stdlib that already exists to automagically get that functionality.

    [0]: https://github.com/ziglang/zig/blob/master/src/stage1/os.hpp

    [1]: https://github.com/ziglang/zig/blob/a9c4dc84f487c4764c578743...

    10 projects | news.ycombinator.com | 14 Aug 2022
    Zig, the programming language Bun is written on, is currently having some Windows headaches of its own: https://github.com/ziglang/zig/issues/12420

    I wonder how much of Bun's immaturity is due to Zig's own immaturity.

  • Announcing: MiniRust
    7 projects | news.ycombinator.com | 8 Aug 2022
    Take https://github.com/ziglang/zig/issues/12251 as an example. Several people from the Rust and Haskell community slacked off on twitter about how awful of a language design this is. However, when you think about what the language actually compiles to it makes perfect sense, and is pretty straightforward.

    Rust has the goal of putting as much smartness between what you type and what gets produces, which is a perfectly fine goal, but without a specification for the input semantics it's a pretty wobbly thing, especially for a systems programming language. A lot of bit packing code is simply not writable in rust today without immediately invoking UB, that works for now but might break with every bugfix release.

  • The pervasive effects of C's malloc() and free() on C APIs
    2 projects | news.ycombinator.com | 7 Aug 2022
    > This is unavoidable in any language that (supports dynamic memory allocation and) moves dynamic memory allocation into a library.

    Not necessarily. The Zig[1] standard library forces callers to provide at runtime an allocator to each data structure or function that allocates. Freeing is then handled either by running deinit() on the datastructure returned (a standard convention), or, if the function returns a pointer, using the same allocator you passed in to free the returned buffer. C's problem here is it doesn't have namespaces or member functions, so there's a mix of conventions for what the freeing function should be called.

    C++ allows this as well for standard library containers, although I've rarely seen it used.

    > Also, say a DLL function returns a char pointer containing a string. How would you know whether to call free or delete on it? Or, maybe, the equivalent of free in Frob, the language that DLL happens to be written in?

    I have to concede this one. I can't see a way out of this other than documentation.

    [1]: https://ziglang.org/

  • Original source of `(seed * 9301 and 49297) % 233280` random algorithm?
    2 projects | news.ycombinator.com | 6 Aug 2022
    On modern hardware, you should instead use a count-leading-zeroes instruction to directly generate the exponent bits from a uniform bit pattern. This is what is done in the Zig standard library:


  • Bound Functions
    1 project | reddit.com/r/Zig | 6 Aug 2022
    Issue for it being removed
  • WebAssembly with Zig, Part 1
    2 projects | dev.to | 5 Aug 2022
    A simpler language exists, named Zig. Zig is a newish language that still hasn't hit a 1.0 milestone release quite yet, it's currently at 0.9.1. But Zig is, in my eyes, a very good language. It's plain, it's simple, and you can read through the documentation pretty easily. It lends itself to classic C, and borrows ideas from other languages in a few places.
  • Why is GitHub so important?
    1 project | reddit.com/r/learnprogramming | 4 Aug 2022
    it's more than just file sharing. you can view the history of each git commit, different branches of the same codebase, an issues tab to manage bugs, pull requests for the merging of code from one branch to another and plenty more
  • Why no function overloading?
    1 project | reddit.com/r/Zig | 2 Aug 2022
    I can't seem to find any rationale for Zig not supporting function overloading, only mentions from Andrew that Zig does not and probably never will have it. Meanwhile that's one of the worst flaws of C, and one very easily correctable. Have there been any hard counter-arguments given?
  • What is missing in the zig ecosystem?
    2 projects | reddit.com/r/Zig | 31 Jul 2022
    Out of curiosity, when's the last time you looked into it? The deflate implementation got completely rewritten ~6 months ago: https://github.com/ziglang/zig/pull/10552


Posts with mentions or reviews of regex. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-07-29.

What are some alternatives?

When comparing zig and regex you can also consider the following projects:

Nim - Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).

Odin - Odin Programming Language

v - Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io

rust - Rust for the xtensa architecture. Built in targets for the ESP32 and ESP8266

rust - Empowering everyone to build reliable and efficient software.

go - The Go programming language

TinyGo - Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM.

crystal - The Crystal Programming Language

re2 - modern regular expression syntax everywhere with a painless upgrade path [Moved to: https://github.com/SonOfLilit/kleenexp]

node-re2 - node.js bindings for RE2: fast, safe alternative to backtracking regular expression engines.

llvm-project - The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Note: the repository does not accept github pull requests at this moment. Please submit your patches at http://reviews.llvm.org.

zig-range - A range function to loop over an index without an extra variable.