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

com.alogic.matcher.impl.Re2 Maven / Gradle / Ivy

There is a newer version: 1.6.17
Show newest version
package com.alogic.matcher.impl;

import com.alogic.matcher.CommonMatcher;
import com.anysoft.util.Properties;
import com.google.re2j.Pattern;

/**
 * 基于google的RE2的实现
 *
 * @since 1.6.12.57 [20200103]
 */
public class Re2 implements CommonMatcher {

    /**
     * 正则表达式pattern
     */
    protected Pattern pattern = null;

    public Re2(String regex, Properties p){
        pattern = Pattern.compile(regex);
    }

    @Override
    public boolean isMatch(String data) {
        return pattern != null?pattern.matches(data):false;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy