Check if the input is String before regex match
This commit is contained in:
parent
01d4799fb2
commit
61d10bcbc6
1 changed files with 6 additions and 3 deletions
|
@ -27,13 +27,16 @@
|
|||
(def parsed-rdf-syntax (parse (slurp cm/activitystreams-ttl)))
|
||||
|
||||
(defn type-string? [input]
|
||||
(re-matches #"[A-Z]" (str (first input))))
|
||||
(and (string? input)
|
||||
(re-matches #"[A-Z]" (str (first input)))))
|
||||
|
||||
(defn url-string? [input]
|
||||
(re-matches #"https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)" input))
|
||||
(and (string? input)
|
||||
(re-matches #"https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)" input)))
|
||||
|
||||
(defn uri-string? [input]
|
||||
(re-matches #"\w+:(\/?\/?)[^\s]+" input))
|
||||
(and (string? input)
|
||||
(re-matches #"\w+:(\/?\/?)[^\s]+" input)))
|
||||
|
||||
(defn uri-vector? [input]
|
||||
(and (every? #(uri-string? %) input)
|
||||
|
|
Loading…
Reference in a new issue