Mad Libs: Difference between revisions
Content added Content deleted
(+ D) |
(Simpler regex in D entry) |
||
Line 222: | Line 222: | ||
writeln("\nInput a comma-separated list of words " |
writeln("\nInput a comma-separated list of words " |
||
"to replace the following items:"); |
"to replace the following items:"); |
||
auto re = regex("< |
auto re = regex("<.+?>", "g"); |
||
auto fields = story.match(re).map!q{a.hit}().array().sort().uniq(); |
auto fields = story.match(re).map!q{a.hit}().array().sort().uniq(); |
||
writef(" %s: ", fields.join(",")); |
writef(" %s: ", fields.join(",")); |