I wonder if there is a way to generate random string from a regex like:
/[a-z0-9]{5}/.to_s
#=> "dsar3"
I found randexp (https://github.com/benburkert/randexp) but it seems to not work with a basic example like above and anyway I feel it's left abandoned.
Anyone?
/.*/, since the number of characters involved could be any length between 0 an infinite. Should the number of characters be random also, or should we be trying to randomly select a value from an infinite set? Or are you suggesting a constraint wherein the regex could not allow things like * or + (as is the case with your example)?.to_son a regex provide a random matching string, that'd be a pretty serious wtf for the next developer that saw that code.