1

How can I create such program in Java that could accept automata regular expression and a minimum string length (int) and generate possible Strings?

examples of regular regular expressions are

regex             possible strings
(a+b)*            abbababababbbab
ab(a+b)           ababababab, abaaaa, abbbbb, abbaba, . . .

2 Answers 2

2
  1. Compile an automaton (standard automata text book exercise)
  2. Simulate the automaton by walking along the edges recording which symbols you use (branching into parallel simulations if needed)
  3. Output the current string each time you reach an accepting state.
Sign up to request clarification or add additional context in comments.

Comments

0

This library mentioned in this post (which generates a random, matching string, I believe) maybe of use

Using Regex to generate Strings rather than match them

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.