• Java 正则提取银行短信内容


    使用 matcher.group()

    Pattern pattern = Pattern.compile("[\*0-9\.:]+");
    Matcher matcher = pattern.matcher("【华夏银行】您的华夏卡(**6999),05月29日11:03到账人民币0.34元,银联代付,余额12.86元");
    while (matcher.find()) {
        String group = matcher.group();
        System.out.println(group);
    }
    

    使用 mathcer.replaceAll()

    Pattern compile = Pattern.compile("[^\d\.:]+");
    Matcher matcher = compile.matcher("【华夏银行】您的华夏卡(**6999),05月29日11:03到账人民币0.34元,银联代付,余额12.86元");
    String s = matcher.replaceAll(" ");
    System.out.println(s);
    

    使用 string.split()

    String content = "【华夏银行】您的华夏卡(**6999),05月29日11:03到账人民币0.34元,银联代付,余额12.86元";
    String[] strings = content.split("[^\d\.:]+");
    System.out.println(strings);
    
  • 相关阅读:
    raw socket
    selenium and win32api
    linux ip
    network config
    grub paramiter & menu.list
    实用命令dd
    resin or tomcat .war e.g. note
    JSP 运行
    linux command screen
    docker interact example
  • 原文地址:https://www.cnblogs.com/Godfunc/p/10690221.html
Copyright © 2020-2023  润新知