public static Rule COUNT(final Rule rule, final int from, final int to) {
		return new Rule() {
			@Override
			public Object exec(GenericMatcher matcher) {
				ArrayList<Object> result = new ArrayList<Object>();
				int i = 0;
				for (;;) {
					Object m = rule.exec(matcher);
					if (m == null) {
						if (from == -1 || i >= from)
							return result;
						return null;
					}
					result.add(m);
					i++;
					if (to != -1 && i == to)
						return result;
				}
			}
		};
	}