1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
//! # Fuzzy Regex
//!
//! A fuzzy regular expression engine that combines traditional regex constructs
//! with fuzzy (approximate) string matching using Damerau-Levenshtein automata.
//!
//! ## Features
//!
//! - **Fuzzy literal matching**: Match strings with edit distance tolerance
//! - **Full regex support**: Character classes, quantifiers, groups, alternation, anchors
//! - **Per-segment fuzziness**: Control fuzziness for individual parts of a pattern
//! - **Capture groups**: Named and numbered capture groups
//! - **Similarity scoring**: Get match quality scores (0.0 - 1.0)
//!
//! ## Quick Start
//!
//! ```rust
//! use fuzzy_regex::FuzzyRegex;
//!
//! // Simple fuzzy matching - hello~2 allows up to 2 edits
//! let re = FuzzyRegex::builder("hello~2")
//! .similarity(0.7)
//! .build()
//! .unwrap();
//!
//! assert!(re.is_match("hello")); // Exact match
//! assert!(re.is_match("helo")); // 1 deletion
//! assert!(re.is_match("helllo")); // 1 insertion
//! ```
//!
//! ## Pattern Syntax
//!
//! ### Fuzziness Markers
//!
//! - `hello~2` - Allow up to 2 edits in "hello"
//! - `hello~0` - Exact match only (no edits)
//! - `hello~{i=1,d=2,s=0}` - Detailed limits: 1 insertion, 2 deletions, 0 substitutions
//! - `(hello world)~2` - Fuzziness on entire group
//!
//! ### Standard Regex Constructs
//!
//! - `[a-z]`, `\d`, `\w`, `\s` - Character classes
//! - `*`, `+`, `?`, `{n,m}` - Quantifiers
//! - `(group)`, `(?:non-capture)` - Groups
//! - `(?<name>...)` - Named capture groups
//! - `a|b` - Alternation
//! - `^`, `$` - Anchors
//! - `(?=...)`, `(?!...)` - Lookahead
//!
//! ## Examples
//!
//! ### Fuzzy Search
//!
//! ```rust
//! use fuzzy_regex::FuzzyRegexBuilder;
//!
//! let re = FuzzyRegexBuilder::new(r"color~2|colour~2")
//! .similarity(0.8)
//! .build()
//! .unwrap();
//!
//! // Matches various spellings
//! assert!(re.is_match("color"));
//! assert!(re.is_match("colour"));
//! assert!(re.is_match("colur")); // With typo
//! ```
//!
//! ### Capture Groups with Fuzzy Matching
//!
//! ```rust
//! use fuzzy_regex::FuzzyRegex;
//!
//! let re = FuzzyRegex::new(r"(?<word>\w+)").unwrap();
//! let caps = re.captures("hello").unwrap();
//! assert_eq!(caps.name("word").unwrap().as_str(), "hello");
//! ```
//!
//! ### Replace with Fuzzy Matching
//!
//! ```rust
//! use fuzzy_regex::FuzzyRegexBuilder;
//!
//! // Match "recieve" (common misspelling) and replace with correct spelling
//! // Note: fuzzy matching allows edits including insertions/deletions at boundaries,
//! // so we use exact match here (~0) to replace just the misspelled word
//! let re = FuzzyRegexBuilder::new(r"recieve~0")
//! .build()
//! .unwrap();
//!
//! let result = re.replace("Did you recieve the package?", "receive");
//! assert_eq!(result, "Did you receive the package?");
//! ```
// Re-export mimalloc for consumers who want to use it as global allocator
pub use MiMalloc;
/// Compiler for converting parsed regex AST into executable IR.
/// Core matching engines including NFA simulation and Bitap algorithm.
/// Intermediate representation for compiled regex patterns.
/// Regex pattern parser and lexer.
// Re-export main types at crate root
pub use ;
pub use EditCounts;
pub use ;
pub use ;