You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Philippe Mouawad <pm...@apache.org> on 2017/10/22 18:34:38 UTC

Generate RandomString from a set of characters

Hello,
Is it possible in commons-text or commons-lang to generate a Random String
from:

- Either a range of characters defined in a regex ? [a-z][0-9] for example
- Either following a pattern (https://github.com/mifmif/Generex)


Thanks
Regards

Re: Generate RandomString from a set of characters

Posted by "Bruno P. Kinoshita" <ki...@apache.org>.
TIL :-)

Sent from Yahoo Mail on Android 
 
  On Mon, 23 Oct 2017 at 20:39, Pascal Schumacher<pa...@gmx.net> wrote:   Am 23.10.2017 um 05:29 schrieb Bruno P. Kinoshita:
> However, I don't think java faker provides random values based on regular expressions.
By the way java faker can provide random values based on regular 
expressions:

new Faker().regexify(String regex)

It uses Generex to archive this.

Cheers,
Pascal

  

Re: Generate RandomString from a set of characters

Posted by Pascal Schumacher <pa...@gmx.net>.
Am 23.10.2017 um 05:29 schrieb Bruno P. Kinoshita:
> However, I don't think java faker provides random values based on regular expressions.
By the way java faker can provide random values based on regular 
expressions:

new Faker().regexify(String regex)

It uses Generex to archive this.

Cheers,
Pascal


Re: Generate RandomString from a set of characters

Posted by "Bruno P. Kinoshita" <br...@yahoo.com.br.INVALID>.
Hi Philippe,
I believe the Random String generators are using a random number generator, combined with some logic for generating codepoints.
But I can see the point for allowing it to generate regular expressions too. Might be useful to allow users to generate text from a regular expression too. Could you file an issue in JIRA for that?
Perhaps someone will volunteer to work on this. I would start by looking at the Builder in RandomStringGenerator, and at the TextRandomProvider interface. Perhaps you could create your own, using Generex, and send us the example to include in the website documentation?
I normally use [text] random string generator, or java faker [1]. However, I don't think java faker provides random values based on regular expressions.
Hope that helpsBruno
[1] https://github.com/DiUS/java-faker

      From: Philippe Mouawad <pm...@apache.org>
 To: Commons Users List <us...@commons.apache.org> 
 Sent: Monday, 23 October 2017 7:34 AM
 Subject: Generate RandomString from a set of characters
   
Hello,
Is it possible in commons-text or commons-lang to generate a Random String
from:

- Either a range of characters defined in a regex ? [a-z][0-9] for example
- Either following a pattern (https://github.com/mifmif/Generex)


Thanks
Regards