Java 正規表現スペース

スペースを一致させる

\s を使用して スペース、 と一致させます。

        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

おすすめ

転載: blog.csdn.net/weixin_44021334/article/details/134220604