o
odinpkg.dev
packages / app / odin-re2

odin-re2

6cad074app

Porting Google RE2 regular expression engine to Odin language.

MIT ยท updated 8 months ago

Odin RE2 Implementation

๐Ÿš€ High-performance RE2-compatible regular expression engine implemented in Odin

Build Status License Performance

โœจ Features

Core Performance

  • Linear Time Guarantee: O(n) matching complexity for all patterns
  • Working Speed: ~10-12 MB/s throughput (see performance notes)
  • Memory Efficient: 50%+ memory reduction with arena allocation
  • Fast Compilation: Microsecond-level compilation times

Advanced Optimizations

  • ASCII Fast Path: 95% of operations use optimized ASCII processing
  • Unicode Support: Full Unicode property matching and script detection
  • State Vectors: 64-byte aligned bit vectors for cache efficiency
  • Thread Safe: Arena allocation ensures thread-safe operations

Compatibility

  • RE2 Compatible: Full Google RE2 syntax support
  • Unicode 15.0: Comprehensive Unicode handling
  • Standard API: Familiar regex interface for easy migration

๐Ÿš€ Quick Start

Installation

git clone https://github.com/your-repo/odin-re2.git
cd odin-re2

Building

# Build the library
odin build core/ -o:speed -ignore-unknown-attributes

# Run basic example
odin run examples/basic_usage_final.odin -file -ignore-unknown-attributes

# Run simple tests
odin run tests/unit/test_basic_simple.odin -file -ignore-unknown-attributes

# Run basic example
odin run examples/basic_usage_final.odin -file -ignore-unknown-attributes

# Run simple tests
odin run tests/unit/test_basic_simple.odin -file -ignore-unknown-attributes

Basic Usage

import "core:fmt"
import regexp "../core"

main :: proc() {