java正则提取图片链接

public static void main(String[] args) {
		  String str = "<input type='text' id='http://xxx.com/a.jpg' name='baijinshan' >";
//		  String regEx="(?<=id=')[\\S\\s]+(?=' name)";
		  String regEx="http://[([a-z0-9]|.|/|\\-)]+.[(jpg)|(bmp)|(gif)|(png)]";
		  Pattern p=Pattern.compile(regEx);
		  Matcher m=p.matcher(str);
		  boolean result=m.find();
		  System.out.println(m.group());
		}
 

你可能感兴趣的:(java)