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

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -