Open deemytch opened 10 years ago
I believe you may have meant:
/^[0-9a-f]{,24}$/.gen
However, I am not sure what omitting the comma SHOULD do.
No, I mean exactly that. In regexpes: {number} means exactly that number of repetitions {,number} means "no more" {number,} means "more than" {number,number} means "between"
that's expression /[0-9a-fA-F]{32}/
correspond to the output of SecureRandom.hex(32)
example:
$ irb
> "bbaaaaa" =~ /a{5}/
=> 2
irb(main):002:0> "aaaaa" =~ /a{6}/
=> nil
Sorry. You're right. It's been a while since I've worked with regexes extensively. Even then I probably would have used {24,24}.
It is a bit odd that there are 24 closing square brackets (']'). Almost like it too all the preceding characters as literals...
/^[0-9a-f]{24}$/.gen produces "^[0-9a-f]]]]]]]]]]]]]]]]]]]]]]]]$"
must be a long hex number