java - How do I generate text matching a regular expression from a regular expression? -
Yes, you read that right, I have something like that created random text from regular expression If the text is able to do then the text should be random, but it should be matched with regular expressions. It seems that it is not in existence, but I can be wrong.
Just an example: This library will be able to take ' [ab] * c
' as input, and generate samples such as:
ABC
ABBC
BAC
etc.
Update: I made some of myself: check out Xeger.
I have created a library to do this one minute ago. Hosted here: Please read the instructions carefully before using it. (Specifically, which refers to downloading another essential library.); -)
The way you use it:
string regex = "[ab] {4, 6} c"; Ezzer Generator = New Zigger (Reggae); String result = generator generates (); Claim the result. Matches (reggae);
Comments
Post a Comment