R
Regex Master
TutorialsToolsFAQAboutContact

String Replace Tool

Test regex-based string replacement with multiple examples and see real-time results.

How to Use This Tool

This tool helps you understand and test regex-based string replacement. Perfect for learning how to use the replace() method with regular expressions.

  1. Enter the text you want to modify
  2. Specify the regex pattern to match
  3. Enter the replacement string (can use $1, $2, etc. for captured groups)
  4. See the results in real-time

Quick Examples

//

Replacement Reference

Capture Group References

  • $1, $2, $3... - Refer to captured groups
  • $& - The entire matched substring
  • $` - The text before the match
  • $' - The text after the match

Common Examples

  • Swap names: (.*) (.*) → $2 $1
  • Add prefix: (.*) → Prefix: $1
  • Email masking: (.*)@(.*) → $1***@***$2
🔥

Popular Patterns

📧

Email Address

Validate standard email formats. Includes support for common domains and subdomains.

Try Email Regex →
📅

Dates (YYYY-MM-DD)

Match dates in ISO 8601 format. Validates year, month, and day structure.

Try Date Regex →
📱

US Phone Number

Match various US phone formats including dashes, dots, and parentheses.

Try Phone Regex →
🌐

IPv4 Address

Validate IPv4 addresses with proper range checking (0-255).

Try IP Regex →
R
Regex Master

Your comprehensive guide to mastering regular expressions through tutorials and tools.

Company

  • About Us
  • Contact
  • FAQ

Resources

  • All Articles
  • Popular Tools
  • Sitemap

Legal

  • Privacy Policy
  • Terms of Service
  • Cookie Policy
  • Disclaimer

© 2026 Regex Master. All rights reserved.