Here you can find the source of createMergedRegex(List
public static String createMergedRegex(List<String> regexes)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static String createMergedRegex(List<String> regexes) { if (regexes == null) { return null; }/*from ww w.j a va 2 s . co m*/ StringBuilder mergedRegexStringBuilder = new StringBuilder(""); int regexCount = regexes.size(); mergedRegexStringBuilder.append("("); for (int i = 0; i < regexCount; i++) { if ((i + 1) < regexCount) { mergedRegexStringBuilder.append(regexes.get(i)).append("|"); } else { mergedRegexStringBuilder.append(regexes.get(i)); } } mergedRegexStringBuilder.append(")"); return mergedRegexStringBuilder.toString(); } }