[番外]:带你玩正则1--数据遍地是,看你取不取

谨言:正则没有捷径,唯一法可破,多想,多用,再多想,再多用

最近想做个Android资源库:toly_res开源库,将一些常用字符串和res资源收录进去
所以找些字符串练练手,做个资源储备,顺便磨一下我正则这把锈迹斑斑的刀
正则的基础知识我就不罗嗦了,一些常用符号不懂的可以自己查一查。
本文将用四个小例子介绍正则的使用


1.一百单八将的获取

随便从网上拷贝一份一百零八将的字符串,怎么把他优化到可用程度?

1.1:去除形如3.37.1的字符

行尾点保留,将作为分割的标示。正则式:"(\\d+\\.)(\\d{0,2}\\.?": 仔细分析一下,想要匹配到的东西:

情况1:---------------------:2.
情况2:---------------------:10.
情况3:---------------------:37.1
情况4:---------------------:44.8.
情况5:---------------------:46.10.

(\\d+\\.)----------说明匹配一个或多个数字,并且后面有点:情况1、情况2 get
(\\d{0,2}\\.?) ----说明匹配零到2个数字,并且后面有一个点或没有点 情况3、情况4、情况5 get

效果就是选中了五种情况,看下效果:
String dest = str.replaceAll("(\\d+\\.)(\\d{0,2}\\.?)","");
复制代码

可见清爽了许多,然后用点.或者:进行切分:


1.2:切割每个人

切割过后数据就规整许多了

String[] strings = dest.split("\\.|:");
for (String string : strings) {
    if (string.contains("…")) {//过滤杂物
        System.out.println(string);
    }
}
复制代码


1.3:创建实体类承接数据
public class Hero {
    private String star;
    private String nickName;
    private String name;
    //get---set---toString略...
}
复制代码
String[] strings = dest.split("\\.|:");
for (String string : strings) {
    if (string.contains("…")) {//过滤杂物
        string= string.replaceAll("\\s", "");
        String[] split = string.split("…");
        heroes.add(new Hero(split[0], split[1], split[2]));
    }
}
System.out.println(heroes);
复制代码

好了,现在对象的列表都在手上,还不随意摆弄吗?


1.4为了方便使用,生成Json字符串

implementation 'com.google.code.gson:gson:2.8.5'

GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.setPrettyPrinting();//美化输出的json格式化
String json = gsonBuilder.create().toJson(heroes);
复制代码

从网上拷贝的介绍文到实体化,再转为json字符串,只用了这点代码,如果靠手动挡,估计要敲的够呛。
对于一些有规律而复杂的字符串,优先考虑逻辑生成。才能以一敌百,解放双手。
此字符串已收录:toly_res开源库

[
  {
    "star": "天魁星",
    "nickName": "呼保义",
    "name": "宋江"
  },
  {
    "star": "天罡星",
    "nickName": "玉麒麟",
    "name": "卢俊义"
  },
  {
    "star": "天机星",
    "nickName": "智多星",
    "name": "吴用"
  },
  {
    "star": "天闲星",
    "nickName": "入云龙",
    "name": "公孙胜"
  },
  {
    "star": "天勇星",
    "nickName": "大刀",
    "name": "关胜"
  },
  {
    "star": "天雄星",
    "nickName": "豹子头",
    "name": "林冲"
  },
  {
    "star": "天猛星",
    "nickName": "霹雳火",
    "name": "秦明"
  },
  {
    "star": "天威星",
    "nickName": "双鞭",
    "name": "呼延灼"
  },
  {
    "star": "天英星",
    "nickName": "小李广",
    "name": "花荣"
  },
  {
    "star": "天贵星",
    "nickName": "小旋风",
    "name": "柴进"
  },
  {
    "star": "天富星",
    "nickName": "扑天",
    "name": "李应"
  },
  {
    "star": "天满星",
    "nickName": "美髯公",
    "name": "朱仝"
  },
  {
    "star": "天孤星",
    "nickName": "花和尚",
    "name": "鲁智深"
  },
  {
    "star": "天伤星",
    "nickName": "行者",
    "name": "武松"
  },
  {
    "star": "天立星",
    "nickName": "双抢将",
    "name": "董平"
  },
  {
    "star": "天捷星",
    "nickName": "没羽箭",
    "name": "张清"
  },
  {
    "star": "天暗星",
    "nickName": "青面兽",
    "name": "扬志"
  },
  {
    "star": "天佑星",
    "nickName": "金抢手",
    "name": "徐宁"
  },
  {
    "star": "天空星",
    "nickName": "急先锋",
    "name": "索超"
  },
  {
    "star": "天速星",
    "nickName": "神行太保",
    "name": "戴宗"
  },
  {
    "star": "天异星",
    "nickName": "赤发鬼",
    "name": "刘唐"
  },
  {
    "star": "天杀星",
    "nickName": "黑旋风",
    "name": "李逵"
  },
  {
    "star": "天微星",
    "nickName": "九纹龙",
    "name": "史进"
  },
  {
    "star": "天究星",
    "nickName": "没遮拦",
    "name": "穆弘"
  },
  {
    "star": "天退星",
    "nickName": "插翅虎",
    "name": "雷横"
  },
  {
    "star": "天寿星",
    "nickName": "混江龙",
    "name": "李俊"
  },
  {
    "star": "天剑星",
    "nickName": "立地太岁",
    "name": "阮小二"
  },
  {
    "star": "天平星",
    "nickName": "船火儿",
    "name": "张横"
  },
  {
    "star": "天罪星",
    "nickName": "短命二郎",
    "name": "阮小五"
  },
  {
    "star": "天损星",
    "nickName": "浪里白条",
    "name": "张顺"
  },
  {
    "star": "天败星",
    "nickName": "活阎罗",
    "name": "阮小七"
  },
  {
    "star": "天牢星",
    "nickName": "病关索",
    "name": "扬雄"
  },
  {
    "star": "天慧星",
    "nickName": "拼命三郎",
    "name": "石秀"
  },
  {
    "star": "天暴星",
    "nickName": "两头蛇",
    "name": "解珍"
  },
  {
    "star": "天哭星",
    "nickName": "双尾蝎",
    "name": "解宝"
  },
  {
    "star": "天巧星",
    "nickName": "浪子",
    "name": "燕青"
  },
  {
    "star": "地魁星",
    "nickName": "神机军师",
    "name": "朱武"
  },
  {
    "star": "地煞星",
    "nickName": "镇三山",
    "name": "黄信"
  },
  {
    "star": "地勇星",
    "nickName": "病尉迟",
    "name": "孙立"
  },
  {
    "star": "地杰星",
    "nickName": "丑郡马",
    "name": "宣赞"
  },
  {
    "star": "地雄星",
    "nickName": "井木犴",
    "name": "赦思文"
  },
  {
    "star": "地威星",
    "nickName": "百胜将军",
    "name": "韩滔"
  },
  {
    "star": "地英星",
    "nickName": "天目将军",
    "name": "彭玑"
  },
  {
    "star": "地奇星",
    "nickName": "圣水将军",
    "name": "单廷"
  },
  {
    "star": "地猛星",
    "nickName": "神火将军",
    "name": "魏定国"
  },
  {
    "star": "地文星",
    "nickName": "圣手书生",
    "name": "萧让"
  },
  {
    "star": "地正星",
    "nickName": "铁面孔目",
    "name": "裴宣"
  },
  {
    "star": "地辟星",
    "nickName": "摩云金翅",
    "name": "欧鹏"
  },
  {
    "star": "地阖星",
    "nickName": "火眼狻猊",
    "name": "邓飞"
  },
  {
    "star": "地强星",
    "nickName": "锦毛虎",
    "name": "燕顺"
  },
  {
    "star": "地暗星",
    "nickName": "锦豹子",
    "name": "扬林"
  },
  {
    "star": "地轴星",
    "nickName": "轰天雷",
    "name": "凌振"
  },
  {
    "star": "地会星",
    "nickName": "神算子",
    "name": "蒋敬"
  },
  {
    "star": "地佐星",
    "nickName": "小温候",
    "name": "吕方"
  },
  {
    "star": "地佑星",
    "nickName": "赛仁贵",
    "name": "郭盛"
  },
  {
    "star": "地灵星",
    "nickName": "神医",
    "name": "安道全"
  },
  {
    "star": "地兽星",
    "nickName": "紫髯伯",
    "name": "皇浦端"
  },
  {
    "star": "地微星",
    "nickName": "矮脚虎",
    "name": "王英"
  },
  {
    "star": "地慧星",
    "nickName": "一丈青",
    "name": "扈三娘"
  },
  {
    "star": "地暴星",
    "nickName": "丧门神",
    "name": "鲍旭"
  },
  {
    "star": "地默星",
    "nickName": "混世魔王",
    "name": "樊瑞"
  },
  {
    "star": "地猖星",
    "nickName": "毛头星",
    "name": "孔明"
  },
  {
    "star": "地狂星",
    "nickName": "独火星",
    "name": "孔亮"
  },
  {
    "star": "地飞星",
    "nickName": "八臂哪吒",
    "name": "项充"
  },
  {
    "star": "地走星",
    "nickName": "飞天大圣",
    "name": "李衮"
  },
  {
    "star": "地巧星",
    "nickName": "玉臂匠",
    "name": "金大坚"
  },
  {
    "star": "地明星",
    "nickName": "铁笛仙",
    "name": "马麟"
  },
  {
    "star": "地进星",
    "nickName": "出洞蛟",
    "name": "童威"
  },
  {
    "star": "地退星",
    "nickName": "翻江蜃",
    "name": "童猛"
  },
  {
    "star": "地满星",
    "nickName": "玉笛",
    "name": "孟康"
  },
  {
    "star": "地遂星",
    "nickName": "通臂猿",
    "name": "候建"
  },
  {
    "star": "地周星",
    "nickName": "跳涧虎",
    "name": "陈达"
  },
  {
    "star": "地隐星",
    "nickName": "白花蛇",
    "name": "扬春"
  },
  {
    "star": "地异星",
    "nickName": "白面郎君",
    "name": "郑天寿"
  },
  {
    "star": "地理星",
    "nickName": "九尾龟",
    "name": "陶宗旺"
  },
  {
    "star": "地俊星",
    "nickName": "铁扇子",
    "name": "宋清"
  },
  {
    "star": "地乐星",
    "nickName": "铁叫子",
    "name": "乐和"
  },
  {
    "star": "地捷星",
    "nickName": "花项虎",
    "name": "龚旺"
  },
  {
    "star": "地速星",
    "nickName": "中箭虎",
    "name": "丁得孙"
  },
  {
    "star": "地镇星",
    "nickName": "没遮拦",
    "name": "穆春"
  },
  {
    "star": "地嵇星",
    "nickName": "刀鬼",
    "name": "曹正"
  },
  {
    "star": "地魔星",
    "nickName": "云里金刚",
    "name": "宋万"
  },
  {
    "star": "地妖星",
    "nickName": "摸着天",
    "name": "杜迁"
  },
  {
    "star": "地幽星",
    "nickName": "病大虫",
    "name": "薛永"
  },
  {
    "star": "地伏星",
    "nickName": "金眼彪",
    "name": "施恩"
  },
  {
    "star": "地僻星",
    "nickName": "打虎将",
    "name": "李忠"
  },
  {
    "star": "地空星",
    "nickName": "小霸王",
    "name": "周通"
  },
  {
    "star": "地孤星",
    "nickName": "金钱豹子",
    "name": "汤隆"
  },
  {
    "star": "地全星",
    "nickName": "鬼脸儿",
    "name": "杜兴"
  },
  {
    "star": "地短星",
    "nickName": "出林龙",
    "name": "邹渊"
  },
  {
    "star": "地角星",
    "nickName": "独角龙",
    "name": "邹润"
  },
  {
    "star": "地囚星",
    "nickName": "旱地忽律",
    "name": "朱贵"
  },
  {
    "star": "地藏星",
    "nickName": "笑面虎",
    "name": "朱富"
  },
  {
    "star": "地平星",
    "nickName": "铁臂膊",
    "name": "蔡福"
  },
  {
    "star": "地损星",
    "nickName": "一枝花",
    "name": "蔡庆"
  },
  {
    "star": "地奴星",
    "nickName": "催命判官",
    "name": "李立"
  },
  {
    "star": "地察星",
    "nickName": "青眼虎",
    "name": "李云"
  },
  {
    "star": "地恶星",
    "nickName": "没面目",
    "name": "焦挺"
  },
  {
    "star": "地丑星",
    "nickName": "石将军",
    "name": "石勇"
  },
  {
    "star": "地数星",
    "nickName": "小尉迟",
    "name": "孙新"
  },
  {
    "star": "地阴星",
    "nickName": "母大虫",
    "name": "顾大嫂"
  },
  {
    "star": "地刑星",
    "nickName": "菜园子",
    "name": "张青"
  },
  {
    "star": "地壮星",
    "nickName": "母夜叉",
    "name": "孙二娘"
  },
  {
    "star": "地劣星",
    "nickName": "活阎婆",
    "name": "王定六"
  }
]
复制代码

2.提取书名:(千军万马之中,直取上将首级)

这个比较简单,但挺经典的,直接上代码:
使用了Pattern+Matcher,对匹配字符串进行组命名获取,组命名方法:?<xxxxx>,获取方式:matcher.group("xxxxx")

 public void book() {
     Set<String> books = new HashSet<>();
     File file = new File("C:\\Users\\Administrator\\Desktop\\100名著.txt");
     String str = readFile(file);
     Pattern pattern = Pattern.compile("《(?<result>.*?)》");//?<result>是取了一个组名
     Matcher matcher = pattern.matcher(str);
     while (matcher.find()) {
         String book = matcher.group("result");
         books.add(book);
     }
     StringBuilder sb = new StringBuilder("public static String[] " + "BOOKS" + " = new String[]{");
     books.forEach(s -> {
         sb.append("\"《" + s + "》\",");
     });
     sb.append("};");
     System.out.println(sb.toString());
 }
复制代码

很简单就从复杂的文章中获取了书名,而且排除了重复的,是不是四两拨千斤
此字符串已收录:toly_res开源库


3.贴吧中邮箱的抓取

我用Python抓了一些网页然后存在了文件中,本文不注意如何获取字符串,核心在如何获取有用数据

我们的目标:从6000多行字符串中过滤出邮箱


3.1:邮箱格式的分析:

正则匹配式(我习惯为组取名字,这样容易看,不然很容易晕,以后也容易看):
(?<result>(?<first>\w)(?<username>[\w\.]{0,27})@(?<yuming>[\w]+\.(com|cn|com\.cn|net\.cn|edu|gov|org)))

 /**
  * 邮箱验证
  * 1981462002@qq.com
  * toly.1994_king@123.com
  * ggl0228@163.com
  * wangshizhihao@foxmail.com
  * tchzw@126.com
  * 954007646@aw.com
  * 
  * 用户名:字母、数字、下划线、点
  * 用户名首字符:字母
  * 用户:长度小于28
  *
  * 域名:.com .cn .com.cn .net.cn .edu .gov .org
  */
复制代码

(?<result>(?<first>\w)(?<username>[\w\.]{0,27})@(?<yuming>[\w]+\.(com|cn|com\.cn|net\.cn|edu|gov|org)))

result组是我们需要的总匹配结果
first组是首字母的格式
username组是除首字母外的用户名格式
yuming组是匹配域名
复制代码

3.2:代码实现
@Test
public void email() {
    //文件路径
    File file = new File("C:\\Users\\Administrator\\Desktop\\邮箱.txt");
    String readFile = readFile(file);
    judgeEmail(readFile);
}
复制代码
private void judgeEmail(String target) {

    String regex = "(?<result>(?<first>\\w)(?<username>[\\w\\.]{0,27})@(?<yuming>[\\w]+\\.(com|cn|com\\.cn|net\\.cn|edu|gov|org)))";

    Pattern pattern = Pattern.compile(regex);
    Matcher matcher = pattern.matcher(target);
    while (matcher.find()) {
        System.out.println(matcher.group("result"));
    }
}
复制代码

3.2:连接成静态字符串数组
private void judgeEmail(String target) {
    String regex = "(?<result>(?<first>\\w)(?<username>[\\w\\.]{0,27})@(?<yuming>[\\w]+\\.(com|cn|com\\.cn|net\\.cn|edu|gov|org)))";
    Pattern pattern = Pattern.compile(regex);//?<result>是取了一个组名
    Matcher matcher = pattern.matcher(target);
    StringBuilder sb = new StringBuilder("public static String[] " + "EMAIL" + " = new String[]{");
    while (matcher.find()) {
        sb.append("\"" + matcher.group("result") + "\",");
    }
    sb.append("};");
    System.out.println(sb.toString());
}
复制代码

好了,控制台里拷过去就能用了,打完收工。
此字符串已收录:toly_res开源库


4.从豆瓣电影的html获取数据

注:喜欢Python爬虫的童鞋不要喷,收起你的唾沫,这里主要演示正则的分析与使用

4.1:打开豆瓣电影,随便找一页,将源代码拷贝出来(当然你也可以通过代码获取网页,这无关紧要)

拷贝出来吓一跳,竟然4000多行,吓得我手一抖,没关系分析分析,切切就少了


4.2:主要的条目如下

用上面的套路,把中间的东西挤出来,一共获得104组数据

@Test
public void movie() {

    Set<String> movies = new HashSet<>();
    File file = new File("C:\\Users\\Administrator\\Desktop\\豆瓣.txt");
    String str = readFile(file);

    Pattern pattern = Pattern.compile("class=\"item\" target=\"_blank\"(?<result>(.|\\s)*?)</a>");//?<result>是取了一个组名
    Matcher matcher = pattern.matcher(str);
    while (matcher.find()) {
        String result = matcher.group("result");
        System.out.println(result);
        movies.add(result);
    }
}
复制代码


4.3:只要将条目再加工,便可以获取信息了

方法详见下:

4.4:创建实体类,承接数据
public class Movie {
    private String name;
    private String imgUrl;
    private String star;
    //get---set---toString略...
}
复制代码
@Test
public void movie() {
    ArrayList<Movie> movies = new ArrayList<>();
    File file = new File("C:\\Users\\Administrator\\Desktop\\豆瓣.txt");
    String str = readFile(file);
    Pattern pattern = Pattern.compile("class=\"item\" target=\"_blank\"(?<result>(.|\\s)*?)</a>
    Matcher matcher = pattern.matcher(str);
    while (matcher.find()) {
        Movie movie = new Movie();
        String result = matcher.group("result");
        //获取名字
        Pattern nameP = Pattern.compile("alt=\"(?<name>(.|\\s)*?)\"");//?<result>是取
        Matcher nameM = nameP.matcher(result);
        while (nameM.find()) {
            String name = nameM.group("name");
            if (!name.contains("<%=")) {
                movie.setName(name);
            }
        }
        //获取图片
        Pattern imgurlP = Pattern.compile("<img src=\"(?<imgurl>(.|\\s)*?)\"");
        Matcher imgurlM = imgurlP.matcher(result);
        while (imgurlM.find()) {
            String imgurl = imgurlM.group("imgurl");
            if (imgurl.contains("http") && !imgurl.contains("ic_new.png")) {
                movie.setImgUrl(imgurl);
            }
        }
        //获取评分
        Pattern starP = Pattern.compile("<strong>(?<star>(.|\\s)*?)</strong>");
        Matcher starM = starP.matcher(result);
        while (starM.find()) {
            String star = starM.group("star");
            if (!star.contains("<%=")) {
                movie.setStar(star);
            }
        }
        movies.add(movie);
    }
    System.out.println(movies.size());//104
}
复制代码
4.5:转化成Json字符串备用
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.setPrettyPrinting();//美化输出的json格式化
String json = gsonBuilder.create().toJson(movies);
System.out.println(json);
复制代码
[
  {
    "name": "新女性",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2246439495.jpg",
    "star": "8.3"
  },
  {
    "name": "血腥星期天",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p787880217.jpg",
    "star": "8.1"
  },
  {
    "name": "哆啦A梦:大雄的宇宙漂流记",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2520702618.jpg",
    "star": "8.1"
  },
  {
    "name": "狐妖小红娘剧场版:下沙",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2295069298.jpg",
    "star": "8.3"
  },
  {
    "name": "自然之子",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p1306331510.jpg",
    "star": "8.3"
  },
  {
    "name": "与安德烈晚餐",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p1893376830.jpg",
    "star": "8.2"
  },
  {
    "name": "猫儿历险记",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p1605686921.jpg",
    "star": "8.3"
  },
  {
    "name": "哆啦A梦:大雄和发条都市",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2520702327.jpg",
    "star": "8.0"
  },
  {
    "name": "哆啦A梦:大雄的宇宙小战争",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2520699109.jpg",
    "star": "8.2"
  },
  {
    "name": "大雄的怀念奶奶",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2369337420.jpg",
    "star": "9.5"
  },
  {
    "name": "利兹与青鸟",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2515806508.jpg",
    "star": "8.9"
  },
  {
    "name": "狼屋",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2534473847.jpg",
    "star": "8.0"
  },
  {
    "name": "啊!设计",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2509012048.jpg",
    "star": "9.4"
  },
  {
    "name": "少年泰坦出击电影版",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2513656628.jpg",
    "star": "8.0"
  },
  {
    "name": "芬妮的旅程",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2358296290.jpg",
    "star": "8.4"
  },
  {
    "name": "大红灯笼高高挂",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2461788317.jpg",
    "star": "8.8"
  },
  {
    "name": "机动战士高达THE ORIGIN VI 赤色彗星诞生",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2518242401.jpg",
    "star": "8.7"
  },
  {
    "name": "五月的四天",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p1918431707.jpg",
    "star": "8.6"
  },
  {
    "name": "血色清晨",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p1263506579.jpg",
    "star": "8.0"
  },
  {
    "name": "代号基亚斯:反叛的鲁路修1之兴道",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2499190654.jpg",
    "star": "8.1"
  },
  {
    "name": "妄想学生会 剧场版",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2503166245.jpg",
    "star": "8.1"
  },
  {
    "name": "笑傲江湖",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2224051619.jpg",
    "star": "8.0"
  },
  {
    "name": "遥望南方的童年",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2516014437.jpg",
    "star": "9.2"
  },
  {
    "name": "机动战士高达THE ORIGIN V 激战 鲁姆战役篇",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2499505254.jpg",
    "star": "8.7"
  },
  {
    "name": "山丘之王",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2174134502.jpg",
    "star": "8.1"
  },
  {
    "name": "再世人狗缘",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2538276076.jpg",
    "star": "8.2"
  },
  {
    "name": "罗密欧与朱丽叶",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2224933614.jpg",
    "star": "9.4"
  },
  {
    "name": "狐妖小红娘剧场版:千颜",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2496051870.jpg",
    "star": "8.7"
  },
  {
    "name": "理查三世",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2407018702.jpg",
    "star": "8.5"
  },
  {
    "name": "亚人2:冲突",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2327065799.jpg",
    "star": "8.3"
  },
  {
    "name": "霹雳奇幻 生死一剑",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2518143759.jpg",
    "star": "8.0"
  },
  {
    "name": "克罗地亚宪法",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2493755634.jpg",
    "star": "8.2"
  },
  {
    "name": "葛饰北斋:为画痴狂",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2479070167.jpg",
    "star": "8.1"
  },
  {
    "name": "我这样过了一生",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2233892203.jpg",
    "star": "8.2"
  },
  {
    "name": "警察与小偷",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2174353218.jpg",
    "star": "8.7"
  },
  {
    "name": "寂静人生",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2204300672.jpg",
    "star": "8.4"
  },
  {
    "name": "月光诗篇",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2158251717.jpg",
    "star": "8.0"
  },
  {
    "name": "炼狱",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2509224206.jpg",
    "star": "8.5"
  },
  {
    "name": "罗马11时",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2230837721.jpg",
    "star": "9.1"
  },
  {
    "name": "开战",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2540477486.jpg",
    "star": "8.1"
  },
  {
    "name": "福禄双霸天",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p1690617156.jpg",
    "star": "8.4"
  },
  {
    "name": "银河铁道之夜",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p740452252.jpg",
    "star": "8.5"
  },
  {
    "name": "伊丽莎白",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2264336223.jpg",
    "star": "9.6"
  },
  {
    "name": "飞行员的妻子",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2458238800.jpg",
    "star": "8.1"
  },
  {
    "name": "完美对垒",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p1284297564.jpg",
    "star": "8.3"
  },
  {
    "name": "红柿子",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2538697684.jpg",
    "star": "8.9"
  },
  {
    "name": "满城风雨",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2171856537.jpg",
    "star": "8.4"
  },
  {
    "name": "豆满江",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p862943814.jpg",
    "star": "8.1"
  },
  {
    "name": "温柔的怜悯",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2176187973.jpg",
    "star": "8.2"
  },
  {
    "name": "影子大地",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p978240555.jpg",
    "star": "8.6"
  },
  {
    "name": "新女性",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2246439495.jpg",
    "star": "8.3"
  },
  {
    "name": "血腥星期天",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p787880217.jpg",
    "star": "8.1"
  },
  {
    "name": "哆啦A梦:大雄的宇宙漂流记",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2520702618.jpg",
    "star": "8.1"
  },
  {
    "name": "狐妖小红娘剧场版:下沙",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2295069298.jpg",
    "star": "8.3"
  },
  {
    "name": "自然之子",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p1306331510.jpg",
    "star": "8.3"
  },
  {
    "name": "与安德烈晚餐",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p1893376830.jpg",
    "star": "8.2"
  },
  {
    "name": "猫儿历险记",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p1605686921.jpg",
    "star": "8.3"
  },
  {
    "name": "哆啦A梦:大雄和发条都市",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2520702327.jpg",
    "star": "8.0"
  },
  {
    "name": "哆啦A梦:大雄的宇宙小战争",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2520699109.jpg",
    "star": "8.2"
  },
  {
    "name": "大雄的怀念奶奶",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2369337420.jpg",
    "star": "9.5"
  },
  {
    "name": "利兹与青鸟",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2515806508.jpg",
    "star": "8.9"
  },
  {
    "name": "狼屋",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2534473847.jpg",
    "star": "8.0"
  },
  {
    "name": "啊!设计",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2509012048.jpg",
    "star": "9.4"
  },
  {
    "name": "少年泰坦出击电影版",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2513656628.jpg",
    "star": "8.0"
  },
  {
    "name": "芬妮的旅程",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2358296290.jpg",
    "star": "8.4"
  },
  {
    "name": "大红灯笼高高挂",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2461788317.jpg",
    "star": "8.8"
  },
  {
    "name": "机动战士高达THE ORIGIN VI 赤色彗星诞生",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2518242401.jpg",
    "star": "8.7"
  },
  {
    "name": "五月的四天",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p1918431707.jpg",
    "star": "8.6"
  },
  {
    "name": "血色清晨",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p1263506579.jpg",
    "star": "8.0"
  },
  {
    "name": "代号基亚斯:反叛的鲁路修1之兴道",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2499190654.jpg",
    "star": "8.1"
  },
  {},
  {
    "name": "爱犬情深 第一季",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2538454688.jpg",
    "star": "9.1"
  },
  {
    "name": "小谢尔顿 第二季",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2535092199.jpg",
    "star": "9.4"
  },
  {
    "name": "柯明斯基理论",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2536895917.jpg",
    "star": "8.9"
  },
  {
    "name": "我们由奇迹构成",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2536589132.jpg",
    "star": "8.7"
  },
  {
    "name": "我就是演员",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2533842667.jpg",
    "star": "7.1"
  },
  {
    "name": "威尔森夫人",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2540988694.jpg",
    "star": "8.3"
  },
  {
    "name": "死的赞美",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2539096723.jpg",
    "star": "8.4"
  },
  {
    "name": "贴身保镖",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2532513937.jpg",
    "star": "8.6"
  },
  {
    "name": "我的老板每天死一次",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2538378560.jpg",
    "star": "8.3"
  },
  {
    "name": "女鼓手",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2536446377.jpg",
    "star": "8.2"
  },
  {
    "name": "风味人间",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2541649132.jpg",
    "star": "9.3"
  },
  {
    "name": "奇葩说 第五季",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2534020405.jpg",
    "star": "7.1"
  },
  {
    "name": "大帅哥",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2516809760.jpg",
    "star": "7.4"
  },
  {
    "name": "锋味",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2540670229.jpg",
    "star": "7.6"
  },
  {
    "name": "和陌生人说话 第二季",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2534613620.jpg",
    "star": "9.5"
  },
  {
    "name": "你和我的倾城时光",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2539658224.jpg",
    "star": "6.1"
  },
  {
    "name": "我是大哥大",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2538424795.jpg",
    "star": "9.1"
  },
  {
    "name": "生活大爆炸 第十二季",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2535085957.jpg",
    "star": "9.4"
  },
  {
    "name": "我的天才女友 第一季",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2538458633.jpg",
    "star": "9.4"
  },
  {
    "name": "人不彪悍枉少年",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2540868731.jpg",
    "star": "7.9"
  },
  {
    "name": "原来你还在这里",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2516911622.jpg",
    "star": "7.1"
  },
  {
    "name": "明星大侦探 第四季",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2538816286.jpg",
    "star": "9.0"
  },
  {
    "name": "奇遇人生",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2533929218.jpg",
    "star": "9.1"
  },
  {
    "name": "我们无法成为野兽",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2537556934.jpg",
    "star": "8.1"
  },
  {
    "name": "一本好书",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2536542410.jpg",
    "star": "9.3"
  },
  {
    "name": "将夜",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2538863432.jpg",
    "star": "7.2"
  },
  {
    "name": "毒枭:墨西哥 第一季",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2528450871.jpg",
    "star": "9.2"
  },
  {
    "name": "声入人心",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2537774816.jpg",
    "star": "9.1"
  },
  {
    "name": "王朝",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2537688397.jpg",
    "star": "9.7"
  },
  {
    "name": "美国恐怖故事:启示录 第八季",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2533307834.jpg",
    "star": "8.0"
  },
  {
    "name": "男朋友",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2540938096.jpg",
    "star": "7.2"
  },
  {
    "name": "阿尔罕布拉宫的回忆",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2538782562.jpg",
    "star": "8.5"
  },
  {
    "name": "西南联大",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2539266159.jpg",
    "star": "9.3"
  },
  {
    "name": "如懿传",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2460165077.jpg",
    "star": "7.4"
  },
  {
    "name": "新西游记 第五季",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2534172628.jpg",
    "star": "9.6"
  },
  {
    "name": "了不起的麦瑟尔夫人 第二季",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2540377118.jpg",
    "star": "9.0"
  },
  {
    "name": "锵锵行天下",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2534078057.jpg",
    "star": "9.2"
  },
  {
    "name": "大恋爱:与将我忘记的你",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2535742933.jpg",
    "star": "8.7"
  },
  {
    "name": "上新了·故宫",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2537957246.jpg",
    "star": "8.2"
  },
  {
    "name": "生活对我下手了",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2540394945.jpg",
    "star": "7.9"
  },
  {
    "name": "请回答1988",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2272563445.jpg",
    "star": "9.7"
  },
  {
    "name": "中学圣日记",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2536470150.jpg",
    "star": "8.0"
  },
  {
    "name": "吐槽大会 第三季",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2538347989.jpg",
    "star": "6.4"
  },
  {
    "name": "非自然死亡",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2510604929.jpg",
    "star": "9.3"
  },
  {
    "name": "内在美",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2534573970.jpg",
    "star": "8.0"
  },
  {
    "name": "我们的四十年",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2538815501.jpg",
    "star": "7.4"
  },
  {
    "name": "幸福一家人",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2531292580.jpg",
    "star": "6.3"
  },
  {
    "name": "鬼入侵",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2534588882.jpg",
    "star": "8.7"
  },
  {
    "name": "新西游记 第六季",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2539335911.jpg",
    "star": "9.7"
  },
  {
    "name": "我们这一天 第三季",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2533297798.jpg",
    "star": "9.6"
  },
  {
    "name": "爱犬情深 第一季",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2538454688.jpg",
    "star": "9.1"
  },
  {
    "name": "小谢尔顿 第二季",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2535092199.jpg",
    "star": "9.4"
  },
  {
    "name": "柯明斯基理论",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2536895917.jpg",
    "star": "8.9"
  },
  {
    "name": "我们由奇迹构成",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2536589132.jpg",
    "star": "8.7"
  },
  {
    "name": "我就是演员",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2533842667.jpg",
    "star": "7.1"
  },
  {
    "name": "威尔森夫人",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2540988694.jpg",
    "star": "8.3"
  },
  {
    "name": "死的赞美",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2539096723.jpg",
    "star": "8.4"
  },
  {
    "name": "贴身保镖",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2532513937.jpg",
    "star": "8.6"
  },
  {
    "name": "我的老板每天死一次",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2538378560.jpg",
    "star": "8.3"
  },
  {
    "name": "女鼓手",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2536446377.jpg",
    "star": "8.2"
  },
  {
    "name": "风味人间",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2541649132.jpg",
    "star": "9.3"
  },
  {
    "name": "奇葩说 第五季",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2534020405.jpg",
    "star": "7.1"
  },
  {
    "name": "大帅哥",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2516809760.jpg",
    "star": "7.4"
  },
  {
    "name": "锋味",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2540670229.jpg",
    "star": "7.6"
  },
  {
    "name": "和陌生人说话 第二季",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2534613620.jpg",
    "star": "9.5"
  },
  {
    "name": "你和我的倾城时光",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2539658224.jpg",
    "star": "6.1"
  },
  {
    "name": "我是大哥大",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2538424795.jpg",
    "star": "9.1"
  },
  {
    "name": "生活大爆炸 第十二季",
    "imgUrl": "https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2535085957.jpg",
    "star": "9.4"
  },
  {
    "name": "我的天才女友 第一季",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2538458633.jpg",
    "star": "9.4"
  },
  {
    "name": "人不彪悍枉少年",
    "imgUrl": "https://img3.doubanio.com/view/photo/s_ratio_poster/public/p2540868731.jpg",
    "star": "7.9"
  },
  {}
]
复制代码

此字符串已收录:toly_res开源库


后记:捷文规范
1.本文成长记录及勘误表
项目源码日期备注
V0.1--github2018-12-6带你玩正则1--数据遍地是,看你取不取
2.更多关于我
笔名QQ微信爱好
张风捷特烈1981462002zdl1994328语言
我的github我的简书我的掘金个人网站
3.声明

1----本文由张风捷特烈原创,转载请注明
2----欢迎广大编程爱好者共同交流
3----个人能力有限,如有不正之处欢迎大家批评指证,必定虚心改正
4----看到这里,我在此感谢你的喜欢与支持


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值