Developer Guide: Advanced Fuzzy Map Regular Expressions¶
The Fuzzy Mapping system utilizes standard Python regular expressions, allowing for powerful matching and exclusion patterns, particularly through Negative Lookaheads ((?!...)).
Using Negative Lookaheads for Whitelisting¶
This pattern allows you to define a rule that applies to everything EXCEPT a specific list of words or phrases. This is especially useful in combination with the empty_all pattern to build cumulative, restricted rule sets.
Goal |
Example Rule ( |
Explanation |
|---|---|---|
Apply to All Except One Word |
|
This rule will apply a replacement (or skip logic, here |
Apply to All Except Multiple Words |
`(‘’, r’^(?!Schach |
Matt |
Using Positive Lookaheads for Restricted Rules¶
The standard approach uses Positive Lookaheads or simple capturing groups to restrict a rule to only a specific list of words.
Goal |
Example Rule ( |
Explanation |
|---|---|---|
Apply Only to a Specific List |
`(‘Schachmatt’, r’^(Schach |
Matt |