Real-world regular expressions (regexes) are widely used in practice. Since regexes are difficult to comprehend and write, automatically synthesizing regexes has been an important research problem. However, current techniques face challenges like weak capability in generalization and severely limited support of extended features of regexes. In this paper, we address these challenges via Large Language Models (LLMs) together with semantic manipulations of sub-expressions, and propose PowerSyn, a framework for regex synthesis based on both natural language descriptions and examples and supports extended features. Specifically, we design the prompt suitable for synthesizing regexes with LLMs and present novel algorithms to manipulate sub-expressions, which consider the matching relation, and are guided by examples. The evaluation results demonstrate the significant efficacy of our approach.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Enhancing Multi-modal Regular Expression Synthesis via Large Language Models and Semantic Manipulations of Sub-expressions

  • Zipan Tang,
  • Yixuan Yan,
  • Rongchen Li,
  • Hanze Dong,
  • Haiming Chen,
  • Hongyu Gao

摘要

Real-world regular expressions (regexes) are widely used in practice. Since regexes are difficult to comprehend and write, automatically synthesizing regexes has been an important research problem. However, current techniques face challenges like weak capability in generalization and severely limited support of extended features of regexes. In this paper, we address these challenges via Large Language Models (LLMs) together with semantic manipulations of sub-expressions, and propose PowerSyn, a framework for regex synthesis based on both natural language descriptions and examples and supports extended features. Specifically, we design the prompt suitable for synthesizing regexes with LLMs and present novel algorithms to manipulate sub-expressions, which consider the matching relation, and are guided by examples. The evaluation results demonstrate the significant efficacy of our approach.