class EscapeUtil {

    public static List<String> split(String pArg, String pEscape, String pDelimiter) {
        if (pArg != null) {
            ArrayList<String> ret = new ArrayList<String>();
            Pattern[] pattern = SPLIT_PATTERNS.get(pEscape + pDelimiter);
            if (pattern == null) {
                pattern = createSplitPatterns(pEscape, pDelimiter);
                SPLIT_PATTERNS.put(pEscape + pDelimiter,pattern);
            }

            final Matcher m = pattern[0].matcher(pArg);
            while (m.find() && m.start(1) != pArg.length()) {
                // Finally unescape all escaped parts. Trailing escapes are captured before the delimiter applies
                String trailingEscapes = m.group(2);
                ret.add(pattern[1].matcher(m.group(1) + (trailingEscapes != null ? trailingEscapes : "")).replaceAll("$1"));
            }
            return ret;
        } else {
            return null;
        }
    }

    private  EscapeUtil();

}