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

com.tailoredshapes.underbar.UnderReg Maven / Gradle / Ivy

There is a newer version: 0.1.2
Show newest version
package com.tailoredshapes.underbar;

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

/**
 * Created by tmarsh on 11/2/16.
 */
public interface UnderReg {
    static Pattern pattern(String s) {
        return Pattern.compile(s);
    }

    static Matcher matcher(Pattern re, CharSequence s) {
        return re.matcher(s);
    }

    static List groups(Matcher m) {
        List l = new ArrayList<>();
        if (!m.matches()) {
            return l;
        }

        int groupCount = m.groupCount();

        for (int c = 1; c <= groupCount; c++) {
            String group = m.group(c);
            l.add(group);
        }

        return l;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy