In my application the user can enter his own regex pattern into a text box so he can force a certain input for another user/text box. Is it possible for the user to see an example of a string that would match the regex he has entered? For example if he was to enter: ^[A-Z]{2}$, it would generate a string like “XX” to show the user he can only enter two capital letters.
If there’s no easy way to accomplish this (and I assume there isn’t), how difficult would it be to build? Or does something like this already exist?
Check out Xeger. It looks like it can do what you want. It’s in Java though.
Here is an example from the test suite:
Update: thanks to Nikos Baxevanis, the dk.brics.automaton have been ported to C# at https://github.com/moodmosaic/Fare