Getting resources matching a glob/wildcard pattern
See original GitHub issueIt would be nice if there were a method like ScanResult#getResourcesMatchingWildcard()
for cases where you just want to match something simple like someDir/*.json
. Of course, ScanResult#getResourcesMatchingPattern()
can do the job, but having to write out something like Pattern.compile("^" + SOME_DIR + "/.+\\.json$")
is quite a bit uglier.
A more general solution could be having a ScanResult#getResourcesMatchingPredicate()
method and using that in conjunction with FilenameUtils#wildcardMatch()
from Apache Commons IO, but I assume this wasn’t already implemented because it wouldn’t be compatible with Java 7.
Am I missing any simple workarounds for this problem? Thanks.
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (9 by maintainers)
Top Results From Across the Web
glob – Filename pattern matching - Python Module of the Week
Purpose: Use Unix shell rules to fine filenames matching a pattern. ... for name in glob.glob('dir/subdir/*'): print '\t', name print 'Named with wildcard:' ......
Read more >A Beginner's Guide: Glob Patterns | Malik Browne
Globs, also known as glob patterns are patterns that can expand a wildcard pattern into a list of pathnames that match the given...
Read more >Understanding the glob pattern in Node.js - LogRocket Blog
The glob pattern is most commonly used to specify filenames, called wildcard characters, and strings, called wildcard matching.
Read more >Find Files that Match Wildcard Strings in Java - Baeldung
Learn how to search for files using wildcard patterns in Java. ... searchWithWc(Paths.get("src/test/resources/sfbw"), "glob:*.
Read more >Python Glob: Filename Pattern Matching - PYnative
We can use glob() with wildcard characters to search for a folder or file in a multi-level directory. Two wildcards are most commonly...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Released in 4.8.129. Thanks for your suggestion and your responsive feedback!
Looks good to me. Thanks!