private static int findMatchingParenthesis(String regex, int index) {
		int count = 0;
		for (int i = index + 1; i < regex.length(); ++i) {
			if (count == 0 && regex.charAt(i) == ')')
				return i;
			else if (regex.charAt(i) == '(')
				++count;
			else if (regex.charAt(i) == ')')
				--count;
		}
		return -1;
	}