Re: Expresiones regulares.

From: Date: Wed, 22 Oct 2003 03:26:03 +0000
Subject: Re: Expresiones regulares.
References: 1 2 3 4  Groups: php.general.es 
Request: Send a blank email to general-es+get-41775@lists.php.net to get a copy of this message
Esta si que funciona. Gracias a todos por su colaboración. Hoy he aprendido algo nuevo y es que el - va delante y no al final. JEJEJJEJE. Salu2. Odiel. ----- Original Message ----- From: <tests@tiscali.es> To: <lista@phpes.com> Sent: Monday, October 20, 2003 10:43 PM Subject: Re: [PHP-ES] Expresiones regulares. > El Dimarts 21 Octubre 2003 06:27, tests@tiscali.es va escriure: > > Quedaría así: > > ^[-a-z0-9\._]{1}[-a-z0-9\._ ]*[-a-z0-9\._]{1}$ > > Pruébalo un poco, pero aparentemente funciona. > > He usado este miniscript en línea de comandos para probarlo: > > <?php > // borram.php > > // Recogemos la cadena > $cadena = $_SERVER['argv'][1]; > > if( ereg( "^[-a-z0-9\._]{1}[-a-z0-9\._ ]*[-a-z0-9\._]{1}$", $cadena ) ) { > > echo "ok\n"; > > } else { > > echo "error\n"; > > } > ?> > > Y esto es lo que he probado: > > [toni@t Desktop]$ php borram.php "adsf-" > ok > [toni@t Desktop]$ php borram.php "a-ds-f-" > ok > [toni@t Desktop]$ php borram.php "a-ds-f- " > error > [toni@t Desktop]$ php borram.php "-a-ds-f-" > ok > [toni@t Desktop]$ php borram.php " -a-ds-f-" > error > [toni@t Desktop]$ php borram.php "@-a-ds-f-" > error > [toni@t Desktop]$ php borram.php "-a@-ds-f-" > error > [toni@t Desktop]$ php borram.php "-a-ds-f-@" > error > > > Saludos > > -- > bicyclerepairman > tests@tiscali.es > > Big black bugs bleed blue black blood but baby black bugs bleed blue blood. > > --------------------------------------------------------------------- > Archivo On-line: http://www.phpes.com/ > via news: news://news.phpes.com/ > Manual PHP en español: http://www.php.net/manual/es/ > Para dar de baja la suscripción, mande un mensaje a: > lista-unsubscribe@phpes.com

« previous php.general.es (#41775) next »