summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2008-02-13 03:35:30 +0000
committerRich Hickey <richhickey@gmail.com>2008-02-13 03:35:30 +0000
commit88c9ca48cbf38bdb8b73594b6f0ef5e94ea255f7 (patch)
tree387d5c35a354889f5674c3c670d72c05d1c30edf /src
parent307ee85f6c18efc1757bb93d9f5241b60d79003f (diff)
added re-find, re-matcher
Diffstat (limited to 'src')
-rw-r--r--src/boot.clj16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/boot.clj b/src/boot.clj
index 268cc453..8eb6639d 100644
--- a/src/boot.clj
+++ b/src/boot.clj
@@ -1255,6 +1255,9 @@ test [v]
(do (f) :ok)
:no-test)))
+(defn #^java.util.regex.Matcher re-matcher [#^java.util.regex.Pattern re s]
+ (. re (matcher s)))
+
(defn re-groups [#^java.util.regex.Matcher m]
(let [gc (. m (groupCount))]
(if (zero? gc)
@@ -1265,13 +1268,22 @@ test [v]
ret)))))
(defn re-seq [#^java.util.regex.Pattern re s]
- (let [m (. re (matcher s))]
+ (let [m (re-matcher re s)]
((fn step []
(when (. m (find))
(lazy-cons (re-groups m) (step)))))))
(defn re-matches [#^java.util.regex.Pattern re s]
- (let [m (. re (matcher s))]
+ (let [m (re-matcher re s)]
(when (. m (matches))
(re-groups m))))
+
+(defn re-find
+ ([#^java.util.regex.Matcher m]
+ (when (. m (find))
+ (re-groups m)))
+ ([#^java.util.regex.Pattern re s]
+ (let [m (re-matcher re s)]
+ (re-find m))))
+