wildmat | |
wildmat | |
Developer: | Rich Salz |
Genre: | Pattern matching |
wildmat is a pattern matching library developed by Rich Salz. Based on the wildcard syntax already used in the Bourne shell, wildmat provides a uniform mechanism for matching patterns across applications with simpler syntax than that typically offered by regular expressions. Patterns are implicitly anchored at the beginning and end of each string when testing for a match.
In June 2019, Rich Salz released the original version of the now-defunct library on GitHub under a public domain dedication.[1]
There are five pattern matching operations other than a strict one-to-one match between the pattern and the source to be checked for a match.
wildmat is most commonly seen in NNTP implementations such as Salz's own INN, also in unrelated software such as GNU tar and Transmission. GNU tar replaced wildmat with the POSIX fnmatch glob matcher in September 1992. The early version contained a potential out-of-bound access on unclosed .[2]
The original byte oriented wildmat implementation is unable to handle multibyte character sets, and poses problems when the text being searched may contain multiple incompatible character sets. A simplified version of wildmat oriented toward UTF-8 encoding has been developed by the IETF NNTP working group. It is a part of (section 4), the 2006 standard for NNTP.
In the newer INN which supports UTF-8, a "uwildmat" was added which supports all the features of wildmat. This 2000 rewrite, performed by Russ Allbery, fixes the OOB in the original implementation. Tightly-wound C loops were written out into smaller statements.[3]
Rsync includes a GPLv3-licensed wildmat descendant known as wildmatch, modified by Wayne Davison. The Git version control system imports and makes use of it. It does not support UTF-8, but has the OOB fixed and has additional support for character classes and star globs (** for arbitrary-depth).[4]