hola gente!
bueno.. xD.. necesito una manita con expresiones regulares..
necesito validar colores hexadecimal con expresiones regulares.. pero no me sale :S, tengo este codigo
Código:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Pagina nueva 1</title>
</head>
<body>
<form method="POST" action="">
<p><input type="text" name="T1" size="20">
<input type="submit" value="Enviar" name="B1">
<input type="reset" value="Restablecer" name="B2"></p>
</form>
</body>
</html>
<p>
<?php
/**
* @author makesurfer
* @copyright 2007
*/
if($_POST["B1"]){
if(preg_match("((#)?[0-9a-f]+)",$_POST["T1"])){
echo 'es color hexadecimal';
}
else{
echo 'no se color hexadecimal';
}
}
?>
si no pongo el signo de # de todos modos lo acepta :S.. alguien sabe como hacerle para ke me lo valide?
gracias!