(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");