Help Show
Pattern example
Comments to Roby ReylandThis tool is useful for automating text modifications, formatting, or cleaning up text based on custom rules defined with regular expressions.
Input
There are two input fields:
1. Text Input: This is the first field where you can enter any text you want to modify. This text will be used as the base content for the transformations.
2. Pattern & Replacement Input: The second field is where you define the regex patterns and their replacements. Each line should contain one pattern followed by a tab or the text "#TAB#" and then the corresponding replacement string. It may have a third item what is the explanation of the line.
Pattern example
@\d{4}-\d{2}-\d{2}@#TAB#Date@#TAB#converts every date to the word 'Date'
@[A-Z]{2,}@#TAB#Acronym
@[A-Z]{2,}@#TAB#Acronym
In this example:
- The first line will replace any date formatted as
YYYY-MM-DD
with the word "Date". - The second line will replace any sequence of two or more uppercase letters (e.g., acronyms) with the word "Acronym".
How to Use the Page:
- Enter or paste the text you want to transform in the Text Input field.
- Enter your regex patterns and their replacements line by line in the Pattern and Replacement Input field.
- Click on the 'Replace' button to apply all the regex transformations at once to your text.
Result:
- Matches: Displays the results of each replacement instruction.
- Result: The final transformed text is displayed in a text area.
- Compare: SHows the result text with highlighted changes.
Additional Information:
- Each regex pattern and its replacement must be separated by a tab or text '#TAB#'.
- You may add e comment as third element, separated by a tab or text '#TAB#'.
- You may use the 'm' or 'i'-flag, but the 'g'-flag will be ignored.
- You may use the new 'r'-flag (repeat-flag): the replacement operation will be repeated until the text stops changing, up to a maximum of 20 iterations.
- A line beginning with a space character will be ignored.
Try a complex exemple: transform a simple markdown text into html format: Click here.