regex - Getting all matches for a regexp on clojure -
i'm trying parse html file , href's inside it.
so far, code i'm using is:
(map #(println (str "match: " %)) (re-find #"(?sm)href=\"([a-za-z.:/]+)\"" str_response)) str_response being string html code inside it. according basic understanding of clojure, code should print list of matches, far, no luck. doens't crash, doens't match either. i've tried using re-seq instead of re-find, no luck. help?
thanks!
this looks html scraping problem in case, advise using enlive.
something should work
(ns test.foo (:require [net.cgrand.enlive-html :as html])) (let [url (html/html-resource (java.net.url. "http://www.nytimes.com"))] (map #(-> % :attrs :href) (html/select url [:a])))
Comments
Post a Comment