db&w documentation wiki

finest software | finest docs

User Tools

Site Tools


vai:dbw_tb

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:
    1. The (?i) flag is prepended to the regex to enable case-insensitive matching.
    2. Example: *.txt matches file.txt, FILE.TXT, and File.TxT.
  • Character Classes:
    1. Supports [a-z], [A-Z], [0-9], [!0-9] (negation), and [abc] (explicit set).
    2. Example: [a-z][0-9].txt matches a1.txt but not 1.txt.
  • Recursive Globbing (**):
    1. ** is converted to .* in regex, allowing it to match any number of subdirectories.
    2. Example: **/file.txt matches file.txt, dir/file.txt, and dir/subdir/file.txt.
  • Extended Globbing (| and ()):
    1. Supports @(pattern1|pattern2) for OR logic.
    2. Example: file@(A|B).txt matches fileA.txt and fileB.txt.
  • Brace Expansion:
    1. Supports {a,b}.txt to match a.txt or b.txt.
    2. Example: {a,b}.txt matches a.txt and b.txt but not ab.txt.
vai/dbw_tb.txt · Last modified: by lightwolf