Fork me on GitHub

Hey! I want to spec for five characters long numbers: I could use regexes #(re-matches #"\d{5}" %), but I as far as I can understand that could be done in spec. I looked up a bit, but what I found is only s/* s/+ s/? that kind of operators. So, is there that kind of spec? I know about s/cat - but that seem too overkill for when I just want to repeat my regex


while they may work for characters of sequences, I wouldn't use s/* s/+ etc. for that


if you're parsing strings, a normal regex is more appropriate


Oh, I found (s/every :count) - seems like what I wanted


like i said, it's a bad idea


the regex predicate you have up there is the better approach


I want to have more composable regexes and spec seem suited for that, compared to regular regexes

Alex Miller (Clojure team)13:05:33

spec is not designed to be a good string regex parser and is unlikely to perform or work well for that use case as actual regex or a parser

Alex Miller (Clojure team)13:05:04

I want to say there is something else like this out there for composable regexes too


@troglotit The comment thread on this reddit post goes into some of the issues you may run into when using spec for parsing strings