Fork me on GitHub
#malli
<
2023-05-01
>
ilmo07:05:09

Is it possible to validate the form of a keyword somehow (maybe using regular expressions)?

valtteri08:05:40

At least something like this can be done

(def schema [:and
             :keyword
             [:fn #(re-matches #"[a-zA-Z](\d+)" (name %))]])

(m/validate schema :poni)
;; => false
(m/validate schema :a123)
;; => true
(m/validate schema "a123")
;; => false

👍 3