g

glob

v2100607library

No description provided.

0 stars0 forksZlibupdated 5 months ago
Open repo

Odin library to check if paths match a pattern.

I have no idea if this is a reasonable implementation. I just needed globstar support and this seems to work.

Note

For personal use. I will look at issues/PRs at my leisure, or not at all.

Features

  • / path separators (will match \ on Windows)
  • ? any single character
  • * zero or more characters
  • ** zero or more path segments
  • {} matches when one or more sub-patterns match (e.g. {*.md,*.txt})
  • [] single character match from selection (e.g. [ab0-9] matches a, b or any digit)
    • use ! to check if the selection does not match (e.g. [!0-9])

Usage

import "glob"

// one-off check
glob.match("/foo/**/bar{.txt,.md}", "/foo/odin/bar.md") // true

// parse pattern only once for multiple checks
pattern, err := glob.pattern_from_string("/foo/**/bar{.txt,.md}")
defer glob.pattern_destroy(&pattern)
glob.match(pattern, "/foo/odin/bar.md") // true
glob.match(pattern, "/foo/odin/bar.csv") // false
Package Info
Version
v2100607
License
Zlib
Author
@lzurbriggen
Type
library
Forks
0
Created
6 months ago
Updated
5 months ago
Health
maintained
has releases
has readme
has license
Activity
last 56 weeks