原始文本内容太少,写出来的正则会不太准确,java 代码如下:
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class App {
public static void main(String[] args) {
String text = "token=abcde";
Pattern pattern = Pattern.compile("token=(.+)");
Matcher matcher = pattern.matcher(text);
if (matcher.find()) {
System.out.println(matcher.group(1));
}
}
}
运行结果: