Java code to generate random string based on regex -
java code generate random string based on regex. tried generex library , it's not giving exact output. example:
generex generex = new generex("^[6-9]\\d{9}$"); system.out.println(generex.random());
output : ^8677547981$ while expecting output 8677547981.it seems generex not able handle special characters "^" , "$" etc.
can pls help?
generex doesn't need ^
, $
. content created matches regex fully, instead of partial match.
generex generex = new generex("[6-9]\\d{9}"); system.out.println(generex.random());
Comments
Post a Comment