Here you can find the source of splitHtmlTagKeepDelimiter(String tag, String input)
public static List<String> splitHtmlTagKeepDelimiter(String tag, String input)
//package com.java2s; //License from project: Open Source License import java.util.Arrays; import java.util.List; public class Main { public static List<String> splitHtmlTagKeepDelimiter(String tag, String input) { return splitHtmlTagKeepDelimiter(tag, 100, input); }/* w w w . j ava 2s .c om*/ public static List<String> splitHtmlTagKeepDelimiter(String tag, int max, String input) { // max: could not use "+?" because of "Look-behind group does not have // an // obvious maximum length near index NR" String tagRegex = "(<" + tag + ">(.{0," + max + "})</" + tag + ">)"; return splitKeepDelimiter(tagRegex, input); } public static List<String> splitKeepDelimiter(String delimiter, String input) { return Arrays.asList(input.split(// "(?i)" // case insensitive + "((?<="// + delimiter// + ")|(?="// + delimiter// + "))"// )); } }