求教java replaceAll正则表达式写法
展开全部
啥都不说了,直接上代码
String content = "1: In a newly-released report, IEA said it expected oil prices to start picking up in 2017.";
tmp = content.replaceAll( "\\d{1}" , "china");
System.out.println(tmp);
tmp = content.replaceAll( "\\d{2}" , "china");
System.out.println(tmp);
tmp = content.replaceAll( "\\d{3}" , "china");
System.out.println(tmp);
tmp = content.replaceAll( "\\d{4}" , "china");
System.out.println(tmp);
tmp = content.replaceAll( "\\d+" , "china");
System.out.println(tmp);
String content = "1: In a newly-released report, IEA said it expected oil prices to start picking up in 2017.";
tmp = content.replaceAll( "\\d{1}" , "china");
System.out.println(tmp);
tmp = content.replaceAll( "\\d{2}" , "china");
System.out.println(tmp);
tmp = content.replaceAll( "\\d{3}" , "china");
System.out.println(tmp);
tmp = content.replaceAll( "\\d{4}" , "china");
System.out.println(tmp);
tmp = content.replaceAll( "\\d+" , "china");
System.out.println(tmp);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询