On Monday, March 18, 2013 8:37:19 PM UTC+1, Stefan Kamphausen wrote:
>
>
> this works pretty well, at least better than I expected, e.g.:
>
>  user=> (def r1 #"(\s.)")
> #'user/r1
> user=> (def r2 #"([abc])")
> #'user/r2
> user=> (def r3 (re-pattern (str r1 "|" r2)))
> #'user/r3
> user=> r3
> #"(\s.)|([abc])"
> user=> (re-find r3 " x")
> [" x" " x" nil]
> user=> (re-find r3 "b")
> ["b" nil "b"]
>

This is a nice trick, but obviously isn't universal: it works only if you 
build up from parts that are literal regexes. More often that not this will 
not be the case.

-marko
 

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to