Regex Replace

Replace text with regular expressions online, with replacement templates, capture group references, named groups, and flag controls.

Flags
Current PatternEnter a pattern to begin replacing.
Replace ModeReplace all matches
Replacement Count0 replacements
Output Length0 characters

Replacement Template Tips

  • $1 References capture group 1, 2, and so on.
  • $& References the full current match.
  • $<name> References a named capture group value.
  • $$ Outputs a literal dollar sign.

Replacement Details

Review how each match was transformed by the replacement template.

Replacement details will appear here after the pattern finds matches.

Common Replacement Presets

Load a preset to try typical regex replacement workflows.

Reformat Dates

Turn YYYY-MM-DD into MM/DD/YYYY.

Pattern(\d{4})-(\d{2})-(\d{2})
Replacement$2/$3/$1
Source TextPublished: 2024-10-05 Backup: 2025-01-14
Mask Email Addresses

Keep the first character and domain while hiding the rest of the username.

Pattern(?<user>[A-Za-z0-9._%+-])[A-Za-z0-9._%+-]*@(?<domain>[A-Za-z0-9.-]+\.[A-Za-z]{2,})
Replacement$<user>***@$<domain>
Source Texthelp(at)example.com support(at)toolmi.com
Collapse Whitespace

Convert repeated spaces, tabs, and line breaks into a single space.

Pattern\s+
Replacement
Source TextToolMi makes text cleanup easier.
Numbered List to Bullets

Convert ordered steps into Markdown bullet points.

Pattern^(\d+)\.\s+(.+)$
Replacement- $2
Source Text1. Install dependencies 2. Run the build 3. Deploy the app