will you need to dynamically generated the output based on user supplied regex input? or will it ALWAYS be a-zA-Z?
Basically, you need to determine what the range of values is. a-z is 26 values, and then A-Z is another 26. That means you need to generate a number from 1-52. you then need to map your numbers to your output values.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
So, you have the fixed regular expression "[a-zA-Z]+" and you want to generate a random word that matches it? That's easy: generate a random number (>= 1) of lower-case and upper-case letters and concatenate them. No need to bother with difficult things such as trying to use Perl from Java (which is not easy). Java has no built-in method like Perl's random_regex.
Or do you want to be able to do this for arbitrary regular expressions?
since you're always doing a-zA-Z, i'd just write a method that converts the numbers 1-52 to your letters. Then, generate random numbers between 1-52 inclusive.
it shouldn't be hard at all.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors