zoukankan      html  css  js  c++  java
  • 正则

    (http|ftp|https)://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)+\.(png|jpg|gif|gif)

    (http|ftp|https)://(\\S+?)\\.(jpg|png|gif)

    string s = "http://link1.jpg bha http://link2.png blahblah http://link3.gif";
    foreach (Match m in Regex.Matches(s, "http://(\\S+?)\\.(jpg|png|gif)"))
    {
        Console.WriteLine(m.Groups[1].Value);
    }

    private static Regex RegTel = new Regex(@"^([0-9a-zA-Z]|[\u4e00-\u9fa5]|\[|\]|\(|\)|,)+$");

     .replace(/"type":".*?"/,'type:""')

    aa=aa.replaceAll("\"ccfsID\":\"[0-9]*\"", "\"ccfsID\":\""+id1+"\"");

    Regex regCountry = new Regex("(?:Country_Code\":\")([^\"]+)(?:\")", RegexOptions.IgnoreCase);
    if (regCountry.Match(GameInfo).Success) {
    var regResult = regCountry.Match(GameInfo).Groups[1].Value;
    if (!string.IsNullOrEmpty(regResult)) {
    result = regResult;
    }
    }

     (?:Country_Code\\":\\")([^\\]+)(?:\\")

    (?:exp) 匹配exp,不捕获匹配的文本

     (?:Country_Code\\":\\")([^\\]+)(?:\\")

    Regex regCountry = new Regex("(?:Country_Code\":\")([^\]+)(?:\")", RegexOptions.IgnoreCase);

    //java

    (?:\\"playerName\\":\\")([^\\]+)(?:")

    System.out.println(gameInfo+"\n"+gameInfo.length()+"\n");
    if (gameInfo.contains("\\\"playerName\\\":\\\","))
    {
    System.out.println("replace");
    gameInfo=gameInfo.replace("\\\"playerName\\\":\\\",","\\\"playerName\\\":\\\"\\\",");
    }
    else
    {
    String regexPlayName="(?:\\\\\"playerName\\\\\":\\\\\")([^\\\\]+)(?:\")";
    Matcher matcherPlayName=Pattern.compile(regexPlayName).matcher(gameInfo);

    if (matcherPlayName.find())
    {
    String oldPlayerName=matcherPlayName.group(0);
    System.out.println(oldPlayerName);
    String newPlayerName=oldPlayerName.substring(0,oldPlayerName.length() - 1)+"\\\"";

    System.out.println(newPlayerName);
    String ret=matcherPlayName.group(1);
    System.out.println(ret);
    gameInfo=gameInfo.replace(oldPlayerName,newPlayerName);
    }
    //while(matcher2.find())
    //{

    //}

    }
    System.out.println(gameInfo+"\n"+gameInfo.length()+"\n");

  • 相关阅读:
    sublime text 4 vim 插件配置
    ssh-keygen 的使用
    distribution transaction solution
    bilibili 大数据 视频下载 you-get
    Deepin 20.2.1 安装 MS SQL 2019 容器版本
    【转】使用Linux下Docker部署MSSQL并加载主机目录下的数据库
    【转】You Can Now Use OneDrive in Linux Natively Thanks to Insync
    dotnet 诊断工具安装命令
    Linux 使用 xrandr 设置屏幕分辨率
    【转】CentOS 7.9 2009 ISO 官方原版镜像下载
  • 原文地址:https://www.cnblogs.com/zwei1121/p/1260938.html
Copyright © 2011-2022 走看看