String str = "任意字符 ";
Pattern p = Pattern.compile("([^<]*)");
Matcher m = p.matcher(str);
while(m.find()) {
System.out.println(m.group(1));
}
若不能解决,可追问,我继续帮你
String s = "任意字符";
Pattern p = Pattern.compile("(.*)");
Matcher m = p.matcher(s);
if (m.find()) {
System.out.println(m.group(1));
}