正则表达式

DogJay 2016-05-30 后端技术 3977人已围观

    package njsxit.day14; 

    import java.util.regex.Matcher; 

    import java.util.regex.Pattern; 

    public class RegexChallege { 

        public static void main(String ... coding){ 

            String str = "The winter is coming"; 

            String rex = "\Sn\S"; 

            String replace = "X"; 

            Pattern pattern = Pattern.compile(rex); 

            Matcher matcher = pattern.matcher(str); 

            String val = matcher.replaceAll(replace); 

            System.out.println(val); 

        } 

    }

吐槽(0)

文章评论

    共有0条评论

    验证码:

文章目录