private static ArrayList<String> getRowColAndGapsTrimmed(String s)
	{
		if (s.indexOf('|') != -1)
			s = s.replaceAll("\\|", "][");

		ArrayList<String> retList = new ArrayList<String>(Math.max(s.length() >> 2 + 1, 3)); // Approx return length.
		int s0 = 0, s1 = 0; // '[' and ']' count.
		int st = 0; // Start of "next token to add".
		for (int i = 0, iSz = s.length(); i < iSz; i++) {
			char c = s.charAt(i);
			if (c == '[') {
				s0++;
			} else if (c == ']') {
				s1++;
			} else {
				continue;
			}

			if (s0 != s1 && (s0 - 1) != s1)
				break;  // Wrong [ or ] found. Break for throw.

			retList.add(s.substring(st, i).trim());
			st = i + 1;
		}
		if (s0 != s1)
			throw new IllegalArgumentException("'[' and ']' mismatch in row/column format string: " + s);

		if (s0 == 0) {
			retList.add("");
			retList.add(s);
			retList.add("");
		} else if (retList.size() % 2 == 0) {
			retList.add(s.substring(st, s.length()));
		}

		return retList;
	}