summaryrefslogtreecommitdiff
path: root/src/boot.clj
diff options
context:
space:
mode:
Diffstat (limited to 'src/boot.clj')
-rw-r--r--src/boot.clj15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/boot.clj b/src/boot.clj
index 0dfec8ea..34826977 100644
--- a/src/boot.clj
+++ b/src/boot.clj
@@ -1248,14 +1248,23 @@ test [v]
(do (f) :ok)
:no-test)))
+(defn re-groups [#^java.util.regex.Matcher m]
+ (let [gc (. m (groupCount))]
+ (if (zero? gc)
+ (. m (group))
+ (loop [ret [] c 0]
+ (if (<= c gc)
+ (recur (conj ret (. m (group c))) (inc c))
+ ret)))))
+
(defn re-seq [#^java.util.regex.Pattern re s]
(let [m (. re (matcher s))]
((fn step []
- (when (. m (find))
- (lazy-cons (. m (group)) (step)))))))
+ (when (. m (find))
+ (lazy-cons (re-groups m) (step)))))))
(defn re-matches [#^java.util.regex.Pattern re s]
(let [m (. re (matcher s))]
(when (. m (matches))
- m)))
+ (re-groups m))))