使用正则表达式从字符串中查找子字符串

直接上代码:

		String string = "asdasd#_%12.gifdadsa#_%2324.gif";
		String regx = "#_%\\d+.gif";
		Pattern pattern = Pattern.compile(regx,Pattern.CASE_INSENSITIVE);
		Matcher matcher = pattern.matcher(string);
		while(matcher.find()){
			System.out.println(matcher.group());
		}




你可能感兴趣的:(JAVA)