**The problem:** Given a list of [globs](http://en.wikipedia.org/wiki/Glob_%28programming%29), I need to find (and return) a glob from the list that a given string matches or definitively determine that none match in. Excluding setup time, performance must be better than a linear search of all the globs:

```
foreach glob in list:
  if glob.matches(string):
    return glob
return None

```

***The question:** Are there any available libraries (C++ preferred) for this?*

---

Edit: After a bit more thought, I thinkin I can argue that this can be done. Given that globs are more or less regex with a different syntax, a runtime version of lex that uses glob syntax would fit the bill.

Given that the problem can be trivially reduced to a know problem, I'm only still interested in implemented solutions.