Expand description
Vectorscan-based pattern matching for complex validation.
This module provides high-performance regex matching using Vectorscan (the open-source fork of Intel Hyperscan). Key features:
- Match thousands of patterns simultaneously
- SIMD-accelerated on x86_64 (AVX2/AVX-512) and ARM (NEON)
- Stream-oriented for network-speed processing
- Zero-copy pattern matching
§Setup
Vectorscan requires the system library to be installed:
# macOS
brew install vectorscan
# Ubuntu/Debian
apt-get install libvectorscan-dev
# From source
git clone https://github.com/VectorCamp/vectorscan
cd vectorscan && cmake -B build && cmake --build build§Usage
use wellformed_validate::patterns::{PatternDb, PatternId};
// Create a pattern database with built-in patterns
let db = PatternDb::with_builtins().unwrap();
// Match against input
let matches = db.scan("test@example.com");
assert!(matches.contains(PatternId::Email));Structs§
- Match
Result - Result of pattern matching.
- Pattern
Db - Pattern database using regex crate (fallback).
- Pattern
Def - Pre-compiled pattern definitions.
Enums§
- Pattern
Id - Pattern identifier for matching results.
Statics§
- BUILTIN_
PATTERNS - All built-in patterns.
Functions§
- is_
ein_ format - Check if a string matches the EIN format.
- is_
email_ format - Check if a string looks like an email address.
- is_
ssn_ format - Check if a string matches the SSN format.
- is_
zip_ format - Check if a string matches the US ZIP code format.