Instructions:'; echo '
'; echo '
'; if (!isset($_GET['submitpregmatch'])){ //form is not submitted, show form echo '

Description: This tool will test any pregmatch condition using PHP.Testing pregmatch is often difficult without real script.There are so many uses of pregmatch function. We can often see this to validate email address, domain names , etc.So if you are learning PHP programming language, this is one of the most useful functions.


'; echo '
'; echo 'Step 1: Enter pregmatch condition to test,example(in violet): /^[-a-z._@,\'\s]*$/i
'; echo ''; echo ''; echo '
'; echo '
This tool is developed by: PHP Developer. org
'; } else { //pregmatch condition submitted show form $submitpregmatch =trim(stripslashes($_GET['submitpregmatch'])); echo 'Step 2:This form will validate the pregmatch condition you just submitted (in green):'.$submitpregmatch.''; echo '
'; echo 'To change pregmatch criteria, simply reset this form, back to default.'; echo '

'; echo 'PHP will then automatically validate if the string you entered is ACCEPTABLE or INVALID based on the criteria upon form submission.'; echo '
'; echo '

'; if (!isset($_GET['test'])) { //Still not set, show form echo '
'; echo ''; echo 'Enter the string to be test: '; echo ''; echo '
'; } else { //form is set, process input $test =$_GET['test']; $submitpregmatch =trim(stripslashes($_GET['submitpregmatch'])); if (preg_match($submitpregmatch,$test)) { echo 'Step 3 THIS STRING: '.''.$test.''.' DOES MATCH WITH YOUR CONDITION -- ACCEPTED'; } else { echo 'Step 3 THIS STRING: '.''.$test.''.' DOES NOT MATCH WITH YOUR CONDITION -- INVALID'; } echo '

'; echo 'Enter another test again'; echo '
'; echo 'Back to the HOMEPAGE'; } } ?>