Regex
Does anyone know any good Regex generator scripts which would work for large strings. IE a regex which could test a whole script for a series of commands ie a script which would return
<?php echo "lol"; ?> <?PHP echo "LOL"; ?> <?php print "lol"; ?> <?php echo "lol"; echo "meh"; ?> . . .
as true but would return things like
<?php echo "loll"; ?> as false
There is not really any good programs…Regex are always better when they are "Home made"…
But to test these regelura expresion, use the function preg_match
:olol… www.google.com ?
Actually, it shouldn't be too difficult… Just put the code in some variable…
If it contains a lot of single and double quotes, construct it like:
$code = <<<END
<?php
// My Code here
?>
END;
$regex = str_replace('/', '\/', preg_quote($code));
echo preg_match("/^$regex$/", $code) ? 'Good' : 'Bad';
$regex = str_replace('/', '\/', preg_quote($code));
Should form the REGEX for you :)