liquibase.util.RegexMatcher Maven / Gradle / Ivy
package liquibase.util;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Check that a text matches an array of regular expressions.
*
* @author lujop
*/
public class RegexMatcher {
private String text;
private Pattern []patterns;
private boolean allMatched;
/**
* Constructs the matcher
* @param text Text to search for mathces
* @param regexToMatch Regex to match
*/
public RegexMatcher(String text,String [] regexToMatch) {
assert (text != null) && (regexToMatch != null);
this.text=text;
patterns=new Pattern[regexToMatch.length];
for(int i=0;i