Skip to content

Latest commit

 

History

History
44 lines (29 loc) · 1 KB

README.md

File metadata and controls

44 lines (29 loc) · 1 KB

Regex

A Cairo library providing a simplified regex engine supporting essential pattern matching features

Prerequisites

Install Scarb (we recommend using asdf version manager).

Installation

In your project directory, run the following command to add the library as a dependency:

Alternatively, you can manually add the dependency. In your Scarb.toml file, include:

[dependencies]
regex = "0.1.0"

Usage

Import and use the library in your Cairo file:

use regex::RegexTrait;

fn main() {
    // Create a new Regex instance
    let mut pattern = RegexTrait::new("H.llo");

    // Sample text
    let text = "Hello, World!";

    // Check if the text matches the pattern
    let is_match = pattern.matches(text.into());

    println!("Match Found: {}", is_match);
}

For a detailed example of how to integrate and use this library in a Cairo project, check the examples folder.