I think it can be done by generating strings using brute force and then try to match them to the supplied regex and printing if match.
But is there a better way to do this?
Regex are used to test if a string matches a pattern. I am aware of that. I thought it would be interesting to do it the way around.