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

com.webapp.utils.regex.RegexUtils Maven / Gradle / Ivy

There is a newer version: 1.5.0
Show newest version
package com.webapp.utils.regex;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public final class RegexUtils {
	private RegexUtils(){}

	public static String match(String data, String regex) {
	    Matcher matcher = Pattern.compile(regex).matcher(data);
	    return matcher.find() ? matcher.group() : "";
    }

	public static boolean isMatch(String data, String regex) {
	    Matcher matcher = Pattern.compile(regex).matcher(data);
	    return matcher.matches();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy