package com.diaoyun.zion;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

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

/**
 * 正则表达式的匹配 Test
 */
@RunWith(SpringRunner.class)
@SpringBootTest
public class RegularTest {

    @Test
    public void test() {
        String pattern = "https://h.uniqlo.cn/#/product?pid=u0000000012717";
        boolean b = Pattern.matches("^.*uniqlo.*\\/\\#\\/product\\?pid=u\\d+", pattern);
        System.err.println(b);

    }

    @Test
    public void test01() {
        String s = "https://www.adidas.com.cn/item/EH2458/D56452";
        Pattern pattern = Pattern.compile("\\w+\\d+");
        Matcher matcher = pattern.matcher(s);
        matcher.find();
        System.err.println(matcher.group());

    }
}
