1.在javascript中:
var str=‘int year = 2018;System.out.println(year + "不是闰年")';
str.match(/[a-zA-Z]+/ig);
//结果["int", "year", "System", "out", "println","year "]
2.在java中:
Pattern p = Pattern.compile("[a-zA-Z]+");
Matcher m = p.matcher(keywords[i].trim());
while (m.find()) {
System.out.println(m.group() + " 位置:[" + m.start() + "," + m.end() + "]");
}