A simple regex engine implemented in Rust using NFA (Non-deterministic Finite Automata) construction.
- Parses a subset of regex patterns into an NFA.
- Supports:
- Literal matching
- Concatenation
- Alternation (
|) - Kleene star (
*) - Plus repetition (
+) - Optional (
?) [if implemented in builder]
- Runs a basic match computation on input strings.
⚠ Note: Advanced regex features like lookarounds, character classes, and named captures are not yet implemented.
Here are some patterns you can test without hitting unimplemented features:
| Pattern | Meaning |
|---|---|
ab*c |
'a' followed by zero or more 'b''s, then 'c' |
| `dog | cat` |
a.*z |
'a' followed by anything, ending with 'z' |
xyz+ |
'x' 'y' and one or more 'z''s |
| `(a | b)c*` |
git clone https://github.com/yourusername/regex-nfa-engine.git
cd regex-nfa-engine
cargo build=== NFA Regex Engine ===
Choose an option:
0) Enter your own regex
1) ab*c [an 'a' followed by zero or more 'b's, then 'c']
2) a*c|b+ [a's then c OR one or more b's]
3) hello|world [matches 'hello' or 'world']
Enter choice: 1
Using regex: ab*c
Enter string to test (or 'quit' to exit): abc
For 'abc': true