0

My project has objects structured in a tree and needs to implement wild card and pattern matching, path expansion for accessing the said objects. This functionality is very similar to what Bash does with its command line.

A sample query might be

find .\[NC]*\Hospitals\Addresses\*

This would recursively search all nodes below the current one for the Addresses of all hospitals that are located in the states which name starts with N or C (ie Nevada, Nebraska, California, etc).

Are there any existing and fairly lightweight libraries or frameworks for Java to do this? I dont want to reinvent the wheel.

Saideira
  • 2,374
  • 6
  • 38
  • 49

1 Answers1

2

If you have the option to use Java 7, it has glob built in: http://download.oracle.com/javase/tutorial/essential/io/fileOps.html

If not, this StackOverflow question & answers may prove useful: Is there an equivalent of java.util.regex for "glob" type patterns?

Community
  • 1
  • 1
user268396
  • 11,576
  • 2
  • 31
  • 26