package com.yutou.qqbot.utlis;

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

public class PatternTools {
    private static List<String> exec(String regex, String input){
        List<String> list=new ArrayList<>();
        Pattern pattern=Pattern.compile(regex);
        Matcher matcher = pattern.matcher(input);
        while(matcher.find()){
           list.add(matcher.group());
        }
        return list;
    }
    public static List<String> pattern(String text,String start,String end){
        return exec(String.format(".(?<=%s).*(?=%s)", start,end), text);
    }
    public static List<String> getQQ(String text){
        return exec("(@[0-9]\\d*)",text);
    }
}
