Generate a Regular Expression From a List or Set
Generate a Regular Expression From a List or Set of allowable values.
Javadoc available at https://www.javatapas.com/docs/javatapas/util/GenerateRegularExpressionFromSet.html
public static String generateRegularExpressionFromSet(Set<String> codes){
StringJoiner joiner = new StringJoiner("|");
Iterator<String> it = codes.iterator();
while (it.hasNext()){joiner.add(it.next());}
String regex = "(?:" + joiner.toString() + ")";
return regex;
}