note 15735 deleted from function.ereg by jimw

From: Date: Fri, 02 Nov 2001 01:30:39 +0000
Subject: note 15735 deleted from function.ereg by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-20163@lists.php.net to get a copy of this message
Another useful little program for validating your regex : <?php if(isset($text)) { $regex = "^([[:alnum:]]+)\.(htm|html)$"; echo "regex : $regex<br>\n"; $result = eregi($regex,$text,$out); echo "$text " . (($result) ? "is " : "is not ") . "parsed<br>\n"; if(is_array($out)) { while(list($k,$v)=each($out)) echo "$k $v<br>\n"; } } ?> <form action="test.php" method=post> <input type=text name=text value="<?php echo $text; ?>"> </form> Keep this in a handy file called test.php. Replace the $regex contents with the regex string you are testing and you can then test your ereg statement. It only requires slight extensions to cope with ereg_replace. This may seem a trivial program, but it's better than attempting to debug a single line of regex that is misbehaving in a large and complex system.

« previous php.notes (#20163) next »