| name | regex-matcher |
| description | WASM skill providing pattern matching operations for VAK agents. |
Regex Matcher Skill
A WebAssembly module providing pattern matching operations that runs inside the VAK kernel sandbox.
Overview
This skill provides pattern matching for:
- Regex pattern matching
- Glob pattern matching
- Find all matches
- Replace operations
- Text splitting
- Pattern extraction
Building
cargo build -p regex-matcher --target wasm32-unknown-unknown --release
Operations
| Operation | Input | Output | Description |
|---|
matches | (text, pattern) | bool | Check if pattern matches |
find_all | (text, pattern) | Vec | Find all matches |
replace | (text, pattern, replacement) | string | Replace matches |
replace_all | (text, pattern, replacement) | string | Replace all matches |
split | (text, pattern) | Vec | Split by pattern |
extract | (text, pattern) | Vec | Extract capture groups |
glob_match | (path, pattern) | bool | Glob pattern match |
Safety
This skill runs in the VAK WASM sandbox with:
- Epoch preemption: Protection against ReDoS attacks
- Memory limits: Bounded match results
- Pattern validation: Invalid patterns rejected
Usage Example
let matches = kernel.execute_skill("regex-matcher", "matches", &[text, r"\d+"]).await?;
let extracted = kernel.execute_skill("regex-matcher", "extract", &[
text,
r"(\w+)@(\w+\.com)"
]).await?;
Security Considerations
- Regex patterns are validated before execution
- Epoch preemption prevents catastrophic backtracking (ReDoS)
- Use simple patterns when possible for performance
Use Cases
- Extracting structured data from text
- Validating input formats
- Parsing log files and responses
- File path matching for policy rules
Files
Cargo.toml - Crate configuration
src/lib.rs - Skill implementation