vai:dbw_tb
Table of Contents
dbw_tb - A toolbox for Lua
Glob Matching in C++ with `<regex>`
This library provides a flexible glob matching solution in C++ using the <regex> library. It supports:
- Case-insensitive matching
- 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.txt · Last modified: by lightwolf
