Convert regular expressions to plain string patterns.
Regex To String takes a regular expression — pattern plus flags, like /^[a-z]+\d*$/gi — and converts it into a plain string representation you can drop into JSON, a config file, or any language that doesn't support native regex literals. Paste your regex and it outputs the escaped pattern text with its flags separated out, all processed in your browser with no server round-trip.
Made for developers. Typical uses:
Explore more in Developer Tools, read the guides and articles, or see how we test our tools.
Test and debug regular expressions in real-time.
Best for testing regex patterns before using in code
Format, beautify, and validate JSON data with proper indentation.
Best for formatting minified JSON from APIs for readability
Encode and decode URLs for web development.
Best for encoding a search query with spaces and special characters before appending it to a URL