All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.craftercms.commons.lang.RegexUtils Maven / Gradle / Ivy

There is a newer version: 4.3.1
Show newest version
package org.craftercms.commons.lang;

/**
 * Utility methods for regex related operations.
 *
 * @author avasquez
 */
public class RegexUtils {

    private RegexUtils() {
    }

    /**
     * Returns true if the string matches any of the specified regexes.
     *
     * @param str       the string to match
     * @param regexes   the regexes used for matching
     *
     * @return true if the string matches one or more of the regexes
     */
    public static boolean matchesAny(String str, String[] regexes) {
        for (String regex : regexes) {
            if (str.matches(regex)) {
                return true;
            }
        }

        return false;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy