Regular Expression Generation via Selective String Segmentation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional regular expression generation tools, such as Txt2re, lack flexibility in generating regular expressions according to user needs, as they only provide pre-defined patterns and do not allow users to select specific character strings without unnecessary components, limiting their ability to generate expressions that match user-specific requirements.
Innovation Solution
A method and system that allow users to acquire and generate regular expressions by selecting specific character strings from a preset string, recognizing character strings before and after the selection, and applying preset rules based on character features to create a custom regular expression, enhancing flexibility and user satisfaction.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Extent of automation
If conventional regular expression generation tools use pre-defined patterns and automatic recognition rules, then the generation process is automated and efficient, but the flexibility to generate expressions according to user-specific needs is limited
Solution Approach 1:
The patent segments the character string into multiple parts by allowing users to selectively mark different portions. Instead of treating the entire string uniformly, users can divide it into segments and apply different regular expression patterns to each segment, enabling customized expression generation that matches specific user needs while maintaining automated processing capabilities.
Solution Approach 2:
The system transitions from static pre-defined patterns to dynamic pattern selection. Users can dynamically choose which portions of the character string to match and apply different recognition rules based on their specific requirements. This dynamic approach allows the same tool to adapt to various user needs while maintaining automation through rule-based processing.
2Productivity
If the tool recognizes character strings with certain rules automatically, then the generation process is efficient, but the ability to exclude unnecessary components (like square brackets) is lost
Solution Approach 1:
The patent enables users to extract only the desired portions of character strings by allowing selective marking. Users can identify and mark specific segments they want to include in the regular expression while automatically excluding unnecessary components like square brackets or other unwanted elements. This extraction capability maintains efficiency through automated rule application while giving users precise control over what is included.
3Ease of operation
If the tool provides pre-defined text item selection buttons, then the operation is simplified, but the regular expressions generated are limited to predefined patterns only
Solution Approach 1:
The patent creates a universal system that combines the simplicity of pre-defined patterns with the versatility of custom expression generation. The same interface that provides easy-to-use selection buttons also enables users to define custom patterns and apply them to marked segments. This multi-functional approach allows the tool to serve both beginners who need simplicity and advanced users who require customization, expanding the range of generatable expressions while maintaining ease of operation.
Data Source
AI summary
An example method for generating a regular expression includes: acquiring a preset character string; acquiring a to-be-collected character string in the preset character string in response to a trigger instruction; recognizing a character string before the to-be-collected character string from the preset character string, the character string before the to-be-collected character string being used as a first character string; recognizing a character string after the to-be-collected character string from the preset character string, the character string after the to-be-collected character string being used as a second character string; and generating a regular expression of the to-be-collected character string by a first preset rule according to character features of the to-be-collected character string, the first character string and the second character string. The techniques of the present disclosure generate the regular expression of the character string needed by a user.


