public RegexEnvironment(Collection<Environment.Tripple> tripples) {
		super(tripples);

		this.loggers = new HashMap<String, Logger>();
		this.formats = new HashMap<String, String>();
		this.levels = new HashMap<String, Logger.Level>();

		Set<String> regexes = new HashSet<String>();
		for(Environment.Tripple tripple: tripples) {
			String regex = tripple.scope;

			if (regex.isEmpty()) {
				regex = "^.*$";
			} else {
				regex = "^" + tripple.scope.replaceAll("\\.", "\\\\.")
					.replaceAll("\\*", ".*") + "$";
			}
			regexes.add(regex);

			if (tripple.key.equals("logger")) {
				loggers.put(regex, Logger.fromString(tripple.value));
			} else if (tripple.key.equals("format")) {
				formats.put(regex, tripple.value);
			} else if (tripple.key.equals("level")) {
				levels.put(regex, Logger.Level.valueOf(
					tripple.value.toUpperCase()));
			}
		}

		List<String> sorted = new ArrayList<String>(regexes);
		Collections.sort(sorted, new Comparator<String>() {
			@Override
			public int compare(String arg0, String arg1) {
				int one = arg0.split("\\\\.").length;
				int two = arg1.split("\\\\.").length;
				if (one == two) {
					one = arg1.split("\\*").length;
					two = arg0.split("\\*").length;
				}
				return two - one;
			}
		});

		this.patterns = new ArrayList<Pattern>();
		for (String regex: sorted) {
			patterns.add(Pattern.compile(regex));
		}
	}