Generating regular expressions from natural language specifications: A semantics-based approach and an empirical study