TRE uses extended regular expression syntax with the addition of "directions" for matching preceding fragment in approximate way. Each of such directions specifies how many typos are allowed for this fragment.
Approximate matching5 is performed in a way similar to Levenshtein distance, which means that there are three types of typos 'recognized':6
TRE allows specifying of cost for each of three typos type independently.
The project comes with a command-line utility, a reimplementation of agrep.
Though approximate matching requires some syntax extension, when this feature is not used, TRE works like most of other regular expression matching engines. This means that
The library's author states11 that time spent for matching grows linearly with increasing of input text length, while memory requirement is constant during matching and does not depend on the input, only on the pattern.
Other features, common for most regular expression engines could be checked in regex engines comparison tables or in list of TRE features on its web-page.
Approximate matching directions are specified in curly brackets and should be distinguishable from repetitive quantifiers (possibly with inserting a space after opening bracket):
Apart from C, TRE is usable through bindings for Perl, Python and Haskell.12 It is the default regular expression engine in R.13 However, if the project should be cross-platform, each target platform would need a separate interface.
Since other regular expression engines usually do not provide approximate matching ability, there is almost no concurrent implementation with which TRE could be compared. However, there are a few things which programmers may wish to see implemented in future releases:14
"Tre for Windows". http://gnuwin32.sourceforge.net/packages/tre.htm ↩
"Using fuzzy searches with tre-agrep". Linux Magazine. https://www.linux-magazine.com/Issues/2016/186/Command-Line-tre-agrep/(offset)/3 ↩
"R: Pattern Matching for Raw Vectors". MIT.edu. http://web.mit.edu/r/current/arch/i386_linux26/lib/R/library/base/html/grepRaw.html ↩
"tre 0.8.0-6 (x86_64)". July 7, 2020. https://www.archlinux.org/packages/community/x86_64/tre ↩
Andoni, Alexandr; Krauthgamer, Robert; Onak, Krzysztof (2010). Polylogarithmic approximation for edit distance and the asymmetric query complexity. IEEE Symp. Foundations of Computer Science (FOCS). arXiv:1005.4033. Bibcode:2010arXiv1005.4033A. CiteSeerX 10.1.1.208.2079. /wiki/ArXiv_(identifier) ↩
"TRE web-page - Regex Syntax". https://laurikari.net/tre/documentation/regex-syntax/ ↩
"Tre-agrep has all of grep's functionality but can also do ambiguous or fuzzy" ↩
"TRE web-page - About". https://laurikari.net/tre/about/ ↩
"TRE web-page - FAQ". https://laurikari.net/tre/faq/ ↩
"Regular Expressions as used in R". https://stat.ethz.ch/R-manual/R-devel/library/base/html/regex.html ↩
Trofimovich, Ulya (2019). "Tagged Deterministic Finite Automata with Lookahead". arXiv:1907.08837 [cs.FL]. practical improvements .. Lurikari algorithm, notably .. /wiki/ArXiv_(identifier) ↩