So I am converting some Ruby code I have into CLojure for practice/fun and I
am having trouble finding info via Google.

I want to take something like this from Ruby and do it in Clojure:

DATE_REGEX = /^\s*(\d{4})\s+(\d{1,2})\s+(\d{1,2})/

token =~ DATE_REGEX
[$1, $2, $3]

So far my best guess has been:

(defonce date-regex #"^\s*(\d{4})\s+(\d{1,2})\s+(\d{1,2})")
(re-find date-regex line)

but I'm not sure how to access $1, $2, and $3


Another example I'd like to convert is this:

DAYS_OF_WEEK_REGEX = /^\s*(#{Date::DAYS_OF_WEEK.join('|')})/i

token =~ DAYS_OF_WEEK_REGEX
$1.downcase.to_sym

Best attempt is:

(defonce days-of-week-regex #"mon|tue|wed|thu|fri|sat|sun(?i)")
(re-find days-of-week-regex line)

Here I'd love to know the syntax for ignore-case, along with how to access $1.

Thanks,
Alex

-- 
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