Loading

4.正则表达式入门之限定符

1.限定符

在这里插入图片描述

2.实例学习

1){n}

n 是一个非负整数。匹配确定的 n 次。
例子:

public static void main(String[] args) {
   
    String str="liife is  a fuck _movie";
    //获得一个正则表达式对象
    Pattern p = Pattern.compile("li{2}fe.*");
    //使用正则表达式对象处理指定字符串,并获得结果对象
    Matcher m = p.matcher(str);
    //从正则表达式结果对象中获得信息
    while 
posted @ 2021-12-17 08:33  文牧之  阅读(5)  评论(0)    收藏  举报  来源