5

Possible Duplicates:
Reverse regular expressions to generate data
Random string that matches a regexp

hello,

i wonder if it's possible to auto-generate valid data by specifying a regular expression. what i want to do is: providing a regular expression and auto-generate examples of data where the regular expression matches for it -- is this possible? maybe there's already a tool or script available for doing such?

thanks!

update

maybe i've found a solution for it: there's the perl module Parse::RandGen::Regexp which apparently does what i want ...

http://metacpan.org/pod/Parse::RandGen::Regexp

... haven't tested it thoroughly, though ...

Community
  • 1
  • 1
aurora
  • 9,607
  • 7
  • 36
  • 54
  • I don't know of any, but it would be quite valuable to make sure no illegal data gets through. It can be a bit daunting to read complex regular expressions, and to get a list of many cases that passes the expression would make testing a lot easier – simendsjo Jun 24 '10 at 13:02
  • Do you need to know the answer for a specific programming language? As the question is, you would probably get vague answers, or answers that refers to a programming language you are not interested. – apaderno Jun 24 '10 at 13:04
  • +1 For cool concept - I can see this being extremely useful for generating and seeding databases during development – Jamie Wong Jun 24 '10 at 13:05
  • @kiamlaluno: i am open for anything -- i wasn't sure, if this is possible anyway, because regular expresions can get very complex. – aurora Jun 24 '10 at 13:37
  • @harald: If you are looking for a tool to use, then maybe this question is for Super User. – apaderno Jun 24 '10 at 13:48
  • 1
    possible duplicate: http://stackoverflow.com/questions/205411/random-string-that-matches-a-regexp – macf00bar Jun 24 '10 at 13:57
  • @kiamlaluno: sorry, i ment: i'm open to any programming language. i'm of course interested in the implementation. php would be fine as solution, but i'm also interested in solutions in other languages or even ideas of how this may be implemented. – aurora Jun 24 '10 at 14:08
  • i always wonder, if the people voting for closing a question read _and_ _understand_ the question? in no way, this is a duplicate of the mentioned questions -- even worse: the other questions do not have a useful answer -- at least not for me. so, what is "closing" good for anyway!? – aurora Sep 06 '11 at 10:20

0 Answers0