Does anybody know an elegant way to have a regex pattern with
capturing groups like in this simple example:

user=> (def pat #"^foo=([^;]*);bar=([^;]*);$")
#'user/pat

user=> (re-seq pat "foo=F0o;bar=bAr;")
(["foo=F0o;bar=bAr;" "F0o" "bAr"])

And reuse that pattern to generate a text that replaces the groups
like this:

user=> (re-gen pat "foo-gen" "bar-gen")
"foo=foo-gen;bar=bar-gen"

Actually, I wouldn't mind if the common representation was not a
Pattern, but something else, as long as I can use just one
representation as input and can do both matching and generating with
it.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to