Is there a library (any language) that provides matching on multisets like Perl regex work on strings? That is to say, I provide a declarative notation of what I want to match in a multiset of characters (which is unordered as opposed to an ordered string of characters), and the engine goes and tries to find a solution without me needing to specify a concrete algorithm.