vai:dbw_tb
This is an old revision of the document!
Table of Contents
dbw_tb - A toolbox for Lua
This is a custom library of tools designed to work with vai.
local tb = require("dbw_tb")
Currently there's only one function to match a string to a pattern using advanced globbing:
glob_match (string, pattern, caseInsensitive)
The pattern can be the following:
Glob Matching in C++ with `<regex>`
This library provides a flexible glob matching solution in C++ using the <regex> library. It supports:
- Character classes (
[a-z],[!0-9]) - Recursive globbing (
**) - Extended globbing (
|,()) - Brace expansion (
{a,b}.txt)
Features
- Case-Insensitive Matching:
- The
(?i)flag is prepended to the regex to enable case-insensitive matching. - Example:
*.txtmatchesfile.txt,FILE.TXT, andFile.TxT.
- Character Classes:
- Supports
[a-z],[A-Z],[0-9],[!0-9](negation), and[abc](explicit set). - Example:
[a-z][0-9].txtmatchesa1.txtbut not1.txt.
- Recursive Globbing (
**):**is converted to.*in regex, allowing it to match any number of subdirectories.- Example:
**/file.txtmatchesfile.txt,dir/file.txt, anddir/subdir/file.txt.
- Extended Globbing (
|and()):- Supports
@(pattern1|pattern2)for OR logic. - Example:
file@(A|B).txtmatchesfileA.txtandfileB.txt.
- Brace Expansion:
- Supports
{a,b}.txtto matcha.txtorb.txt. - Example:
{a,b}.txtmatchesa.txtandb.txtbut notab.txt.
vai/dbw_tb.1789637559.txt.gz · Last modified: by lightwolf
