Comments (5)
Thanks!
For .Wildcard().WildCard()
I think you want .DirectoryWildcard()
For [a-zA-Z0-9]**
are you saying you want to match one single character that is within the range a-z or A-Z or 0-9, followed by anything?
**
can only be used when its the only thing in a segment.. i.e foo/**/bar
is fine. foo**
is not fine.
At the moment I think you could create three seperate globs like so:
[a-z]/**
, [A-Z]/**
and [0-9]/**
Using the glob builder that might be something like:
var lowerCase = new GlobBuilder().LetterInRange('a', 'z')
.PathSeperator(PathSeperatorKind.BackwardSlash)
.DirectoryWildcard()
.ToGlob();
var upperCase = new GlobBuilder().LetterInRange('A', 'Z')
.PathSeperator(PathSeperatorKind.BackwardSlash)
.DirectoryWildcard()
.ToGlob();
var number = new GlobBuilder().NumberInRange(0,9)
.PathSeperator(PathSeperatorKind.BackwardSlash)
.DirectoryWildcard()
.ToGlob();
Actually you can condense that to two seperate globs, by doing a case-insenstive
match for the a-z
. For example:
var options = new GlobOptions();
options.Evaluation.CaseInsensitive = true;
var letterGlob = new GlobBuilder().LetterInRange('a', 'z')
.PathSeperator(PathSeperatorKind.BackwardSlash)
.DirectoryWildcard()
.ToGlob(options);
var numberGlob = new GlobBuilder().NumberInRange(0,9)
.PathSeperator(PathSeperatorKind.BackwardSlash)
.DirectoryWildcard();
var result = letterGlob.IsMatch("a/foo/bar/baz") || numberGlob.IsMatch("a/foo/bar/baz");
However I am not sure I can do better than this seperate glob idea at present - i.e I don't think you can create a single glob, that matchesa single character that is within the range a-zA-Z0-9
at present.
Hopefully that makes sense to you.
from dotnet.glob.
To glob files with a certain extension?
*.pdb
should work for example.
if you want any directory: /**/*.pdb
You can have a look at the test cases as they might help aid you.
from dotnet.glob.
How to select multiple wildcards:
**/package.id/**/*.pdb
from dotnet.glob.
Closing this for now, hopefully your question is answered but let me know if not.
from dotnet.glob.
@dazinator : Thanks for the detailed responses. I wasn't aware of the .DirectoryWildcard() for some reason. :)
from dotnet.glob.
Related Issues (20)
- IndexOutOfRangeException with ** HOT 9
- Bring dotnet glob to sql clr and ef core! HOT 2
- New option for parsing behaviour of invalid ** HOT 9
- Enable sourcelink HOT 1
- Fix build - GitVersion issue. HOT 2
- Build failing
- How to enumerate files and folders with glob? HOT 1
- Cannot build, deprecated dotnet dependencies and more HOT 2
- "**/.*" unexpectedly matches paths ending with dot HOT 4
- Glob failing on matching `/` with Index was outside the bounds of the array HOT 2
- Consider joining the .NET Foundation
- Double check character class logic HOT 1
- Composite character ranges
- Matching partial paths? HOT 2
- Having a dot after a wildcard in a pattern that also has literal directory and wildcard directory matchers can fail to match a valid path HOT 2
- Lots of bugs HOT 7
- Linux filenames with slashes HOT 3
- Multiple Glob Patterns HOT 2
- Inconsistent Matching HOT 2
- README fluent builder example is wrong
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotnet.glob.