While re-findcertainly an option, re-matchesthis is what you would like to match an entire string without providing wrappers ^...$:
(re-matches #"[-a-z]+" "hello-there")
;; => "hello-there"
(re-matches #"[-a-z]+" "hello there")
;; => nil
So your if-construct might look like this:
(if (re-matches
(do-something-with s)
(do-something-else-with s))
source
share