Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Reverse Regex

A reverse regex is a library that produces a string based on a regex. The resulting string satisfies the regex.

Such a tool is good for testing, so as to find possible regexploits, or simple loopholes in the original regex.

<?php

    preg_match('/(foo)(bar)(baz)/', 'foobarbaz', $matches, PREG_OFFSET_CAPTURE);
    print_r($matches);

?>

Documentation