matcheslooking.java

来自「JAVA 工作指南 可以说是程序员必备的东西哦」· Java 代码 · 共 26 行

JAVA
26
字号
import java.util.regex.Pattern;import java.util.regex.Matcher;public class MatchesLooking {    private static final String REGEX = "foo";    private static final String INPUT = "fooooooooooooooooo";    private static Pattern pattern;    private static Matcher matcher;    public static void main(String[] args) {         // Initialize        pattern = Pattern.compile(REGEX);        matcher = pattern.matcher(INPUT);        System.out.println("Current REGEX is: "+REGEX);        System.out.println("Current INPUT is: "+INPUT);        System.out.println("lookingAt(): "+matcher.lookingAt());        System.out.println("matches(): "+matcher.matches());    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?