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
  • Constructor Details

    • Xeger

      public Xeger(String regex, Random random)
      Constructs a new instance, accepting the regular expression and the randomizer.
      Parameters:
      regex - The regular expression. (Not null.)
      random - The object that will randomize the way the String is generated. (Not null.)
      Throws:
      IllegalArgumentException - If the regular expression is invalid.
    • Xeger

      public Xeger(String regex)
      As Xeger(String, java.util.Random), creating a Random instance implicityly.
      Parameters:
      regex - as string
  • Method Details

    • generate

      public String generate()
      Generates a random String that is guaranteed to match the regular expression passed to the constructor.
      Returns:
      generated regexp
    • getRandom

      public Random getRandom()
    • setRandom

      public void setRandom(Random random)