{"repo":"fent/randexp.js","free":true,"listed":false,"github":"https://github.com/fent/randexp.js","clone":"git clone https://github.com/fent/randexp.js.git","description":"Create random strings that match a given regular expression.","language":"JavaScript","stars":1867,"topics":["node","regular-expression","testing"],"license":"MIT","category":"dev-tools","readme_excerpt":"randexp.js randexp will generate a random string that matches a given RegExp Javascript object. Usage If you're only going to use gen() once with a regexp and want slightly shorter syntax for it If you miss the old syntax Motivation Regular expressions are used in every language, every programmer is familiar with them. Regex can be used to easily express complex strings. What better way to generate a random string than with a language you can use to express the string you want? Thanks to String-Random for giving me the idea to make this in the first place and randexp for the sweet .gen() syntax. Default Range The default generated character range includes printable ASCII characters. In order to add or remove characters, a defaultRange attribute is exposed. you can subtract(from, to) and add(from, to) You can also change the default range by changing RandExp.prototype.defaultRange . Custom PRNG The default randomness is provided by Math.random() . If you need to use a seedable or cryptographic PRNG, you can override RandExp.prototype.randInt or randexp.randInt (where randexp is an instance of RandExp ). randInt(from, to) accepts an inclusive range and returns a randomly selected number within that range. Infinite Repetitionals Repetitional tokens such as , + , and {3,} have an infinite max range. In this case, randexp looks at its min and adds 100 to it to get a useable max value. If you want to use another int other than 100 you can change the max property in RandExp.prototyp","default_branch":null,"files":null,"tree":[],"storefront":"/r/fent","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/fent/randexp.js/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}