@@ -84,19 +84,20 @@ protected boolean isRobotAnswer() {
8484 * @return The elaborated messages with command tokens expanded
8585 */
8686 private String parseRobotAnswer (String message ) {
87- RegExp p = RegExp .compile ("\\ [act\\ [[a-zA-Z]*\\ |.*\\ |.*\\ ]act\\ ]" );
88- MatchResult result = p .exec (message );
89-
90- if (result != null ) {
91- for (int i = 0 ; i < result .getGroupCount (); i ++) {
92- String match = result .getGroup (i );
93- match = match .replace (ACT_START , "" );
94- match = match .replace (ACT_END , "" );
95- String link = processCommand (match .split ("\\ |" ));
96- message = message .replace (ACT_START + match + ACT_END , link );
87+ RegExp p = RegExp .compile ("\\ [act\\ [([^\\ ]]+)]act\\ ]" , "g" );
88+ MatchResult result ;
89+
90+ while ((result = p .exec (message )) != null ) {
91+ if (result .getGroupCount () > 1 ) {
92+ String fullMatch = result .getGroup (0 ); // whole [act[...]]act]
93+ String matchContent = result .getGroup (1 ); // inner part
94+
95+ String [] parts = matchContent .split ("\\ |" );
96+ String link = processCommand (parts );
97+
98+ message = message .replace (fullMatch , link );
9799 }
98100 }
99-
100101 return message ;
101102 }
102103
@@ -132,7 +133,7 @@ public static native void declareOpenDocument(DocumentsPanel panel) /*-{
132133 return panel.@com.logicaldoc.gui.frontend.client.document.DocumentsPanel::openInFolder(J)(docId);
133134 };
134135 }-*/ ;
135-
136+
136137 @ UnsafeNativeLong
137138 public static native void declareOpenFolder (FolderNavigator navigator ) /*-{
138139 $wnd.actOpenFolder = function(folderId) {
0 commit comments