On Jun 25, 6:13 am, CuppoJava <patrickli_2...@hotmail.com> wrote:
> Hi,
> I need to dynamically create a regex, and would really like to be able
> to use Clojure's built-in regex syntax. But I don't know how to go
> about it.
>
> My regex is: #"(.*?)(\(image .*)"
>
> except instead of "image", I need to dynamically insert an array of
> possible strings to match.
>
> ie. given ["image" "buffer" "spacer"]
>
> I need to produce #"(.*?)(\((?:image|buffer|spacer) .*)"
>
> Is there a nice way of doing this without having to go back to using
> Java's string syntax?
Is re-pattern what you want? (After building the string, of course.)
--
-asbjxrn
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---