Example-Driven Source Code Text Replacement Synthesizer

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Developers face challenges in efficiently performing high variability find and replace operations in source code, often relying on manual methods or writing regular expressions, which are time-consuming and error-prone, due to the difficulty of using existing search-and-replace tools.

Innovation Solution

A system and method for example-driven text replacement that synthesizes pattern match code and transforms based on user-provided examples, allowing developers to focus on workflow within an integrated development environment without needing to write regular expressions or consult external documentation.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If developers use manual methods or write regular expressions for find and replace operations, then they can perform text replacements in source code, but the process becomes time-consuming and error-prone

Engineering Contradiction:
Improvetext replacement speedVSAvoidtime for find and replace operations
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The system enables self-service by allowing developers to provide simple text examples rather than requiring knowledge of regular expressions. The automated synthesizer translates these simple examples into executable pattern match code and transforms, making the tool serve itself by generating the complex matching logic from user-friendly inputs.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The patent replaces the mechanical system of manually writing and debugging regular expressions with an automated synthesizer that generates pattern match code. This substitution eliminates the need for developers to manually construct complex search patterns, replacing their work with an automated system that derives patterns from simple text examples.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

2Measurement precision

If developers write regular expressions for pattern matching, then they can perform precise text searches, but they need to consult external documentation and lose workflow focus

Engineering Contradiction:
Improvepattern matching accuracyVSAvoidworkflow continuity
Core Design Contradiction:
Measurement precisionVSEase of operation

Solution Approach 1:

The synthesizer acts as an intermediary between the developer's simple text examples and the complex pattern match code. This intermediary component translates the developer's intuitive text inputs into precise regular expressions and pattern match code, eliminating the need for developers to directly engage with complex documentation while maintaining accurate pattern matching.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The system provides self-service by automatically generating pattern match code from simple text examples. The synthesizer handles the complex translation work autonomously, allowing developers to focus on their workflow without needing to consult external documentation for regular expression syntax or behavior.

Inventive Principle:
Principle #25Self-service

3Adaptability or versatility

If existing search-and-replace tools are used, then text replacement can be performed, but they are difficult to use for high variability operations

Engineering Contradiction:
Improvehandling high variability textVSAvoidtool usability
Core Design Contradiction:
Adaptability or versatilityVSEase of operation

Solution Approach 1:

The system implements dynamics by allowing the pattern match code to be generated adaptively from text examples. The synthesizer creates flexible patterns that can handle high variability in the source code, enabling the tool to adapt to different coding styles and patterns without requiring manual configuration for each scenario.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The patent utilizes parameter changes by transforming simple text examples into parameterized pattern match code. The synthesizer generates patterns that can dynamically match various text variations by changing parameters such as wildcards, alternatives, and structural flexibility, enabling handling of high variability operations through automated parameter generation rather than manual tool configuration.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentEP4147123B1Source code text replacement by example
Publication Date: 2024.10.30 MICROSOFT TECHNOLOGY LICENSING LLC
  • EP4147123B1 patent drawingFigure 1~3
  • EP4147123B1 patent drawingFigure 4~6
  • EP4147123B1 patent drawingFigure 7

AI summary

Flexible yet efficient "find" operations search source code for matches to a general pattern after a developer provides an example string that matches the pattern, without requiring the developer to write a regular expression or script that will implement the desired pattern. Example-driven find-replace functionality uses regular expressions or other pattern match codes, and scripts or other transforms, which are synthesized automatically from examples provided by a developer. This technology allows the developer to focus on workflow inside an integrated development environment instead of breaking focus to search for external documentation, or unfortunately foregoing the flexibility and power of regular expressions and scripts. Synthesizer outputs may be directly or indirectly ranked through user feedback, allowing their refinement. Find match generality may be controlled, e.g., by specifying regex star positions or star counts. Entry of guiding examples may be assisted by autocompletion. Performance criteria are also described.