Java regular expression spaces

Match spaces

Use \s to match a space,

        String regexs = "j\\sa";
        System.out.println("j a".matches(regexs));// true
        System.out.println("j aa".matches(regexs));// false
        System.out.println("j av".matches(regexs));// false
        System.out.println("j  a".matches(regexs));// false

Guess you like

Origin blog.csdn.net/weixin_44021334/article/details/134220604