1.0.0 • Published 11 months ago

@psenger/globtoregex v1.0.0

Weekly downloads
-
License
GPL-3.0-or-later
Repository
github
Last release
11 months ago

globtoregex

Glob to RegEx - lightweight tool to convert Apache Glob for Unix to a Regular Expression

About

I needed a lightweight glob to regex converter for a project. I couldn't find one that was light weight enough for my needs so I wrote one.

Installation

npm install @psenger/globtoregex --save

or

yarn add @psenger/globtoregex

Syntax

WildcardDescriptionExampleMatchesDoes not match
*Matches any number of characters zero or more times*.txtfoo.txt, bar.txt, baz.txtfoo.txt.bak, foo.txt/bar.txt
?Matches any single character?.txta.txt, b.txt, c.txtfoo.txt, bar.txt, baz.txt
[abc]Matches any character in the set[abc].txta.txt, b.txt, c.txtfoo.txt, bar.txt, baz.txt
[a-z]Matches any character in the range[a-z].txta.txt, b.txt, c.txtfoo.txt, bar.txt, baz.txt
[!abc]Matches any character not in the set[!C]atBat, bat, or catCat
[!a-z]Matches any character not in the range[!a-z].txtA.txt, B.txt, C.txtfoo.txt, bar.txt, baz.txt
1.0.0

11 months ago