question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting resources matching a glob/wildcard pattern

See original GitHub issue

It 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:closed
  • Created 2 years ago
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
lukehutchcommented, Oct 28, 2021

Released in 4.8.129. Thanks for your suggestion and your responsive feedback!

1reaction
jjlincommented, Oct 28, 2021

Looks good to me. Thanks!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found