show regexp groups, handy for debugging
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Sun, 30 Aug 2020 20:34:57 +0000 (23:34 +0300)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Wed, 2 Sep 2020 20:34:57 +0000 (23:34 +0300)
src/main/java/eu/svjatoslav/commons/string/tokenizer/TokenizerMatch.java

index ebe5175..cd07ec9 100755 (executable)
@@ -50,10 +50,19 @@ public class TokenizerMatch {
 
     @Override
     public String toString() {
-        return "TokenizerMatch{" +
-                "token='" + token + '\'' +
-                ", terminator=" + terminator +
-                '}';
+        StringBuilder result = new StringBuilder();
+        result.append("TokenizerMatch\n" +
+                "  token='" + token + "'\n" +
+                "  terminator=" + terminator + "\n" +
+                "  groups:\n");
+
+        int i = 0;
+        for (String s : getRegExpGroups()) {
+            result.append("    " + i + ": " + s + "\n");
+            i++;
+        }
+
+        return result.toString();
     }
 
     public Tokenizer getTokenizer() {