Data and Math

vfnmatch

Shell style filename patterns, such as *.ven, matched against names.

Released v1.0.0 · 2026-09-28
Import
use "stdlib/fnmatch.ven"

Unix shell style filename pattern matching, such as matching every file ending in a given extension, built on Venutian's own text and pattern matching builtins. It follows the same matching rules as a shell's own glob patterns, so a pattern written for a shell prompt matches the same files when checked through this package instead.

vfnmatch.ven
print translate("*.txt")
Reference (5 functions)

API reference

translate(pattern)

Turns one shell glob pattern into an anchored regex Text.

print(translate("*.txt"))
:: prints: ^(?s:.*\.txt)\Z

fnmatchcase(name, pattern)

Tests whether name matches shell pattern pattern, always case-sensitive.

print(fnmatchcase("REPORT.TXT", "*.txt"))
:: prints: no

fnmatch(name, pattern)

Matches name against pattern the way a shell would on this platform: case-sensitive everywhere except Windows, where filenames are conventionally case-insensitive.

print(fnmatch("report.txt", "*.txt"))
:: prints: yes

fnmatch_filter(names, pattern)

Every element of names (a List of Text) that matches pattern, using the same platform-aware case rule as fnmatch.

print(fnmatch_filter(["report.txt", "notes.md", "summary.txt"], "*.txt"))
:: prints: ["report.txt", "summary.txt"]

fnmatch_filter_case(names, pattern)

Every element of names that matches pattern, always case-sensitive.

print(fnmatch_filter_case(["Report.TXT", "report.txt"], "*.txt"))
:: prints: ["report.txt"]

Get notified when vfnmatch changes

Get notified about

New versions and security advisories.

New and updated packages, once a day.

News on the math model built in Venutian.