miner/strgen

Grouping of character classes doesn't work

Rovanion opened this issue · 2 comments

Hi!

Let me begin by saying that I'm aware of the inverse character classes of \S; then follow it up with the straight up example of #"[^\s]" generating characters not \\ and s instead of non-whitespace-characters.

(re-matches #"[^\s]" "a") ; => "a"

(require '[miner.strgen     :as strgen]
         '[clojure.spec.gen :as spec-gen])

(spec-gen/sample (strgen/string-generator #"[^\s]"))
; => ("\t" "p" "P" "1" "/" "&" "\n" "c" "\r" "u")
(spec-gen/sample (strgen/string-generator #"[\s\S]"))
; => ("\\" "s" "\\" "s" "S" "s" "s" "S" "\\" "S")

Perhaps the regex for a namespaced symbol, represented as a string, is a good example of why this is useful

#"[^\s/]+/[^\s/]+"
miner commented

This should be fixed in version 0.1.3. Please give it a try.

Much better, cheers :D