Package repackaged.nl.flotsam.xeger
Class Xeger
- java.lang.Object
-
- repackaged.nl.flotsam.xeger.Xeger
-
public class Xeger extends Object
An object that will generate text from a regular expression. In a way, it's the opposite of a regular expression matcher: an instance of this class will produce text that is guaranteed to match the regular expression passed in. slight modifications by Marcin Grzejszczak
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringgenerate()Generates a random String that is guaranteed to match the regular expression passed to the constructor.RandomgetRandom()voidsetRandom(Random random)
-
-
-
Constructor Detail
-
Xeger
public Xeger(String regex, Random random)
Constructs a new instance, accepting the regular expression and the randomizer.- Parameters:
regex- The regular expression. (Notnull.)random- The object that will randomize the way the String is generated. (Notnull.)- Throws:
IllegalArgumentException- If the regular expression is invalid.
-
Xeger
public Xeger(String regex)
AsXeger(String, java.util.Random), creating aRandominstance implicityly.- Parameters:
regex- as string
-
-