Regex to Code Generator
Convert regex patterns into JavaScript, Python, Go, Java, or PHP code.
Pattern
// JavaScript
const regex = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g;
const text = "your input string";
// Test for match
if (regex.test(text)) {
console.log("Match found");
}
// Get all matches
const matches = text.match(regex);
console.log(matches);
// Replace
const replaced = text.replace(regex, "REPLACEMENT");
console.log(replaced);