How to use the examples
Enter the pattern without slash delimiters in Regex Find & Replace. Choose flags separately. Test on a short copy of your data before applying a broad pattern.
Find numbers
Pattern: \d+ Input: Order 123, Order 987 Replacement: NUMBER Output: Order NUMBER, Order NUMBER
Normalize whitespace
Pattern: [ \t]+ Replacement: one space
This targets spaces and tabs without consuming line breaks. By contrast, \s+ can include line breaks.
Match the beginning of each line
Pattern: ^ID: Replacement: Item: Flag: m
Multiline mode makes ^ apply after each line break. Use $ for line endings.
Reuse capture groups
Pattern: Order (\d+) Replacement: ID-$1 Input: Order 123 Output: ID-123
Restructure an identifier
Pattern: ([A-Z]{3})-(\d{4})
Replacement: $2/$1
Input: ABC-2026
Output: 2026/ABCReformat a date string
Pattern: (\d{4})-(\d{2})-(\d{2})
Replacement: $3.$2.$1This rearranges matching text but does not validate calendar dates. Use a dedicated date parser when validation matters.
Remove repeated markers
Pattern: (?:TODO:\s*)+ Replacement: TODO:
Before replacing
- Start with global mode off when you want to inspect the first match.
- Use specific character classes instead of
.*when possible. - Keep the original text outside the browser field.
- Check Unicode and locale requirements for international data.