private static List<String> tokenise(String string, Map<Character, Match> matches, char escapeChar, boolean includeSplitCharAsToken) {
		List<String> tokenised = new LinkedList<>();
		StringBuffer sb = new StringBuffer();
		boolean escape = false;

		for (char c : string.toCharArray()) {
			if (!escape && matches.containsKey(c)) {
				// split here
				if (sb.length() > 0) {
					tokenised.add(sb.toString());
					sb = new StringBuffer();
				}
				if (includeSplitCharAsToken) {
					tokenised.add(String.valueOf(c));
				}
				escape = false;
			} else if (c == escapeChar) {
				if (escape) {
					// we've escaped the escape char so this should be added to the string buffer
					sb.append(c);
					escape = false;
				} else {
					escape = true;
				}
			} else {
				sb.append(c);
				escape = false;
			}
		}

		if (sb.length() > 0) {
			tokenised.add(sb.toString());
		}

		return tokenised;
	}