All Projects → alexnask → Ctregex.zig

alexnask / Ctregex.zig

Compile time regular expressions in zig

Projects that are alternatives of or similar to Ctregex.zig

Hyper Match
HyperTerm extension which matches regular expressions with predefined commands
Stars: ✭ 15 (-72.73%)
Mutual labels:  regex
Rexrex
🦖 Composable JavaScript regular expressions
Stars: ✭ 34 (-38.18%)
Mutual labels:  regex
Regxy
Python module for making regex painless.
Stars: ✭ 48 (-12.73%)
Mutual labels:  regex
Comby
A tool for structural code search and replace that supports ~every language.
Stars: ✭ 912 (+1558.18%)
Mutual labels:  regex
Eminim
JSON serialization framework for Nim, works from a Stream directly to any type and back. Depends only on stdlib.
Stars: ✭ 32 (-41.82%)
Mutual labels:  compile-time
Cocoapods Binary
integrate pods in form of prebuilt frameworks conveniently, reducing compile time
Stars: ✭ 1,004 (+1725.45%)
Mutual labels:  compile-time
Whitespace Regex
Regular expression for matching the whitespace in a string.
Stars: ✭ 9 (-83.64%)
Mutual labels:  regex
Regexr
For composing regular expressions without the need for double-escaping inside strings.
Stars: ✭ 53 (-3.64%)
Mutual labels:  regex
Uc Davis Cs Exams Analysis
📈 Regression and Classification with UC Davis student quiz data and exam data
Stars: ✭ 33 (-40%)
Mutual labels:  regex
Phobos
The standard library of the D programming language
Stars: ✭ 1,038 (+1787.27%)
Mutual labels:  regex
Androidutilcode
AndroidUtilCode 🔥 is a powerful & easy to use library for Android. This library encapsulates the functions that commonly used in Android development which have complete demo and unit test. By using it's encapsulated APIs, you can greatly improve the development efficiency. The program mainly consists of two modules which is utilcode, which is commonly used in development, and subutil which is rarely used in development, but the utils can be beneficial to simplify the main module. 🔥
Stars: ✭ 30,239 (+54880%)
Mutual labels:  regex
Cryptocurrency Address Detector
Detect which cryptocurrency an address corresponds to.
Stars: ✭ 30 (-45.45%)
Mutual labels:  regex
Inferregex
Infer the regular expression (regex) of a string 🔤 🔢 🔍
Stars: ✭ 41 (-25.45%)
Mutual labels:  regex
Regex
A sane interface for php's built in preg_* functions
Stars: ✭ 909 (+1552.73%)
Mutual labels:  regex
Fuckie
If my users are using IE, they don't need my beautiful code right ?
Stars: ✭ 48 (-12.73%)
Mutual labels:  regex
Retest
Command-line regular expression tester
Stars: ✭ 13 (-76.36%)
Mutual labels:  regex
Dfa Regex
A DFA regex engine in java.
Stars: ✭ 34 (-38.18%)
Mutual labels:  regex
Crex
Explore, test, and check regular expressions in the terminal.
Stars: ✭ 54 (-1.82%)
Mutual labels:  regex
Regex Builder
Write regular expressions in pure Java
Stars: ✭ 50 (-9.09%)
Mutual labels:  regex
Golang Regex Tutorial
Golang - Regular Expression Tutorial
Stars: ✭ 1,035 (+1781.82%)
Mutual labels:  regex

Zig compile time regular expressions

Generating fast code since 2020

Features

  • Comptime regular expression compilation
  • Comptime and runtime matching
  • UTF8, UTF16le, ASCII, codepoint array support
  • Captures (with named (:<name>...) support)
  • |, *, +, ?, (:?...), [...], [^...], {N}, {min,}, {min,max}
  • '\d', '\s' character classes

TODO

  • Faster generated code using DFAs when possible
  • search, findAll, etc.
  • More character classes
  • More features (backreferences etc.)

Example

test "runtime matching" {
    @setEvalBranchQuota(1250);
    // The encoding is utf8 by default, you can use .ascii, .utf16le, .codepoint here instead.
    if (try match("(?<test>def|abc)([😇ω])+", .{.encoding = .utf8}, "abc😇ωωωωω")) |res| {
        std.debug.warn("Test: {}, 1: {}\n", .{ res.capture("test"), res.captures[1] });
    }
}

test "comptime matching" {
    @setEvalBranchQuota(2700);
    if (comptime try match("(?<test>def|abc)([😇ω])+", .{}, "abc😇ωωωωω")) |res| {
        @compileError("Test: " ++ res.capture("test").? ++ ", 1: " ++ res.captures[1].?);
    }
}

See tests.zig for more examples.
Small benchmark with ctregex, PCRE2

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].