String regEx = "(?<=\[)[\S\s]+(?=\])";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(line);
boolean result = m.find();
System.out.println(m.group());
public class RegexTest {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String str = "<input type='text' id='baijinshan' name='baijinshan' >";
// 正则表达式:以id='开头,以' name结尾。
String regEx="(?<=id=')[\S\s]+(?=' name)";
Pattern p=Pattern.compile(regEx);
Matcher m=p.matcher(str);
boolean result=m.find();
System.out.println(m.group());
}
}