I'm looking for datasets that contain a list of regexps where each regexp is associated with at least one sentence written in English that explains what the regexp does. Examples:

  • "All 3-letter words ending by .at except bat" can be expressed in regexp as [^b]at
  • "Any word starting with the letter s" can be expressed in regexp as s.*

I am aware of the dataset provided with Kushman, Nate, and Regina Barzilay. "Using semantic unification to generate regular expressions from natural language." North American Chapter of the Association for Computational Linguistics (NAACL), 2013., but I'm looking for more data.

I am also aware that there exist different regular expression standards (more precisely the POSIX standard isn't always respected) and I'm okay if the regexp output is not POSIX although I would prefer it was. By the same token I know that two regular expressions can be equivalent just like two description written in English can be equivalents.

Ideally it would be great if each regexp comes with some positive and negative examples as well (e.g. for s.*, "hello" is a negative example, "salut" is a positive example), but it's okay if not.

  • 2
    Are you looking for more "data" or more "examples"? Have you considered something like the regular-expressions-cookbook.com which has samples you can download for free or one of the many RegEx sharing/library sites? – Mark Silverberg Jun 14 '14 at 12:51
  • If you want a sentance explaining what a regex does, you might want to try YAPE::Regex::Explain. I'd also look to various test suites for perl modules if you want regex + what they're supposed to match. Also, your examples make the assumption that you're already starting with a word; if you're not, you might need to prefix them with \b to start at a word boundry. – Joe Jun 15 '14 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.