Ruby gem for generating regular expressions

And back I came across a ruby ​​stone, which with regular expression would generate lines of examples.

For example, given the regular expression:

/[a-z]{5}[0-9]{4}/

it can generate a string:

"hkdbv4578"

Does anyone remember the name of this gem?

+5
source share
4 answers

I believe what you are looking for: https://github.com/benburkert/randexp Randexp

+4
source

I quickly looked around, could not find the gem, but found it https://github.com/repeatedly/ruby-string-random .

It looks like you can generate a string from a regular expression using it.

rubular .

0

You can use the string_pattern gem: https://github.com/MarioRuiz/string_pattern

/[a-z]{5}[0-9]{4}/.gen   #>racst6550

Another way to do this:

['5:x','4:n'].gen    #>aabpq3316
0
source

All available regex stones can be found in RubyGems here .

Perhaps an easier way to test Ruby Regular Expressions would be to use Rubular .

-1
source

All Articles