Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.util.Collection;

import java.util.regex.Pattern;

public class Main {
    public static boolean stringMatchesAnyRegex(String s, Collection<Pattern> regexes) {
        if (s == null || regexes == null || regexes.isEmpty()) {
            return false;
        }

        for (Pattern regex : regexes) {
            if (regex.matcher(s).matches())
                return true;
        }

        return false;
    }
}