Java正则表达式未在多行上拾取多个事件

Java正则表达式未在多行上拾取多个事件,java,regex,Java,Regex,我正在尝试使用java正则表达式跨多行匹配[[1st word | 2nd]]]或[[word]]]的文本模式。例如,我的代码是 String tStr = "Computer science in sport''' is an interdisciplinary discipline that has its goal in combining the theoretical as well as practical aspects and methods of the areas of

我正在尝试使用java正则表达式跨多行匹配
[[1st word | 2nd]]]
[[word]]]
的文本模式。例如,我的代码是

String tStr = "Computer science in sport''' is an interdisciplinary discipline 
that has its goal in combining the theoretical as well as practical aspects 
and methods of the areas of [[Information technology|informatics]] and [[sport 
science]]. The main emphasis of the [[interdisciplinarity]] is placed on the 
application and use of computer-based but also mathematical techniques in sport 
science, aiming in this way at the support and advancement of theory and practice 
in sports.<ref>{{cite web|author=Daniel Link & Martin Lames|title=Sport 
Informatics – Historical Roots";

String validateRegex = "(\\[\\[)(:?)(\\w+)(\\|?)(\\w*)(\\]\\])";
Pattern pattern = Pattern.compile(validateRegex, Pattern.MULTILINE);
Matcher matcher = pattern.matcher(tStr);
while (matcher.find()) {
   System.out.println(matcher.group()+"\n");
}
输出
[[跨学科]]
。然而,我希望看到

[[Information technology|informatics]]
[[sport science]]
[[interdisciplinarity]]

谁能帮我澄清一下我的错误在哪里?给我一个例子,我怎样才能正确地提取预期的模式?

[[信息技术|信息学]]

[[体育科学]]


包含正则表达式中不存在的空格。

如果字符串中没有
\n
,则该字符串不是多行的。在源代码中多行写入并不会添加一行。