Patrick Andrieu: preg match !^[0-9/-]{6,20}$!

Beitrag lesen

Re!

Ich weiß nicht, wie PHP das hier handhabt,

Genauso. Außerdem muss Dynamites Fehler andere Ursachen haben, denn wie man sieht, ergibt die Angabe einer E-Mail-Adresse »WRONG«.

Mein (als nicht PHP-ler bescheidener) Code:

  
<?php  
  
echo "Dynamites Regexp: <pre>!^[0-9/-]{6,20}\$!</pre>";  
echo "<br>";  
  
$tel = "069/123456";  
$mail = "gogogog@gaga.com";  
  
echo "TELEFON: \$tel = $tel";  
echo "<br>";  
echo "MAIL: \$mail = $mail";  
echo "<br>";  
  
$tok = preg_match("!^[0-9/-]{6,20}$!", $tel) ? "OK" : "WRONG";  
$mok = preg_match("!^[0-9/-]{6,20}$!", $mail) ? "OK" : "WRONG";  
  
echo "TELEFON: $tok";  
echo "<br>";  
echo "MAIL: $mok";  
echo "<br>--------------------------<br>";  
  
echo "Andere Regexp: <pre>!^[0-9/\-\s\(\)]{6,20}\$!</pre>";  
  
$tel = "0 (69) 12 34 56";  
$mail = "gogogog@gaga.com";  
  
echo "TELEFON: \$tel = $tel";  
echo "<br>";  
echo "MAIL: \$mail = $mail";  
echo "<br>";  
  
$tok = preg_match("!^[0-9/\-\s\(\)]{6,20}$!", $tel) ? "OK" : "WRONG";  
$mok = preg_match("!^[0-9/\-\s\(\)]{6,20}$!", $mail) ? "OK" : "WRONG";  
  
echo "TELEFON: $tok";  
echo "<br>";  
echo "MAIL: $mok";  
echo "<br>--------------------------<br>";  
  
?>

Viele Grüße aus Frankfurt/Main,
Patrick

--
_ - jenseits vom delirium - _

   Diblom   [link:hatehtehpehdoppelpunktslashslashwehwehwehpunktatomicminuseggspunktcomslash]
J'ai 10 ans! | Achtung Agentur! | Nichts ist unmöglich? Doch! | Heute schon gegökt?