日期:2014-05-17 浏览次数:20660 次
<input type="button" value="jakcy">
Pattern p = Pattern.compile("value=\"(.*?)\"/>");
<input type=\"button\" value=\"jakcy\">
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Hello {
public static void main(String[] args) throws Exception {
String str = "<input type=\"button\" value=\"jakcy\">";
Pattern pattern = Pattern.compile("<input type=\"(.+?)\" value=\"(.+?)\">");
Matcher matcher = pattern.matcher(str);
while (matcher.find()) {
System.out.println("Value is: " + matcher.group(2));
}
}
}
Value is: jakcy