用於從[[text]]中獲取值的正則表達式。我試過了正則表達式用於在括號內獲得值的Java正則表達式
"((?<=[[)*(?=]])*)+" the value between [[ ]] is not obtained.
例如,從字符串[[text]]中,我們應該獲取文本。
Pattern pat = Pattern.compile("((?<=\\[[)*(?=\\]])*)");
Matcher matcher = pat.matcher("[[text]]");
String next ="";
while(matcher.find()) {
next = matcher.group(0);
break;
}
System.out.println(next); //next should be text
請開發你的答案......更好地解釋你的問題,顯示代碼,等... – 2013-03-04 15:54:48
什麼@MatiasCaamaño說 - 建議:舉一個例子。該值可以包含單個']'字符嗎? – 2013-03-04 15:56:55