java如何在模式类中使用变量而不是字符串?
我试图在两个单词之间搜索一个单词,并使用Java中的模式类。到目前为止,我的代码是:
Pattern pattern = Pattern.compile("(?<=PlaintiffAtty_0).*?(?=</span>)");
Matcher matcher = pattern.matcher(sourcecode.toString());
while (matcher.find()) {
System.out.println(matcher.group().toString());
第一个模式词“原告”将随着数字的增加而变化,所以我想把它用作变量。如何在那里插入变量,而不是每次都要更改字符串
共 (0) 个答案