Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Collections; import java.util.regex.Pattern; public class Main { public static ArrayList<Pattern> createArrayListPFromStringArray(final String[] regexArray) { final ArrayList<Pattern> returnPatternsList = new ArrayList<Pattern>(); for (int j = 0; j < regexArray.length; j++) { returnPatternsList.add(Pattern.compile(regexArray[j], Pattern.DOTALL)); } return new ArrayList<Pattern>(Collections.unmodifiableList(returnPatternsList)); } }