Hello,
I am still having trouble with regular expressions. I made this script:
<?php
if (isset($_POST['submit'])) {
$pattern = '#^[01[:alpha:]%]$#';
$string = $_POST['name'];
if(!preg_match($pattern, $string)) {
echo 'please use valid characters';
} else {
echo 'Name format is correct';
}
}
Ok so when I run this script, even if I use alphabetic caracters, 1, 2, or % the message I receive is "please use valid characters", so the pattern is not recognized by PHP
What am I doing wrong? Can anybody tell me?