benburkert / randexp

generate random data from a Regular Expression
MIT License
286 stars 43 forks source link

Say WHAAAT? #16

Closed pvdb closed 7 years ago

pvdb commented 10 years ago

Say WHAAAT?

[5] pry(main)> /abc|def/.gen
=> "def"
[6] pry(main)> /\Aabc|def/.gen
=> "Aabc"
[7] pry(main)> _

/cc @lukaso

tom-lord commented 9 years ago

@pvdb

This gem does not handle "complex" regular expressions correctly. For example:

/[a-z]/.gen # => "[a-z]"
/(?:test)/.gen # => NoMethodError: undefined method `first' for nil:NilClass
/\n/.gen # => "n"

It also does not use "real" regex for various examples, but instead invents its own syntax - for example:

 /[:sentence:]/.gen # => "Nonhearer demetricize toppiece....."

While this gem might be perfectly good for your needs, if you're looking for a more "complete" regexp parser, check out my gem: https://github.com/tom-lord/regexp-examples

pvdb commented 7 years ago

Closing, as no longer relevant for our purposes.