Afficher un message
Vieux 20/06/2008, 22h08   #8
Raistlin Majere
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: regexp to match simple text not working

On Jun 20, 4:50pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Fri, 20 Jun 2008 21:43:05 +0200, Raistlin Majere <pedbe...@gmail.com>
> wrote:
>
>
>
> > On Jun 20, 4:17pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> >> On Fri, 20 Jun 2008 21:08:24 +0200, Raistlin Majere
> >> <pedbe...@gmail.com>
> >> wrote:

>
> >> > define('VALID_MESSAGE', '/^[a-zA-Z0-9 ,.!?\n]{1,10000}$/');
> >> > // it accepts
> >> > testtesttesttesttesttest

>
> >> > // it refuses
> >> > testtest
> >> > testtest
> >> > testtest

>
> >> Most likely, because of \r.
> >> An obvious solution would be:
> >> define('VALID_MESSAGE','/^[a-z0-9,.!?\s]{1,10000}$/i');

>
> Please don't toppost.
>
> > it still says the message is invalid

>
> Not here it doesn't:
> <?php
> $variable = 'tasdtasd
> asdasd
> asdasd
> asdasd';
> $valid = '/^[a-z0-9,.!?\s]{1,10000}$/';
> echo preg_match($valid, $variable) ? 'valid' : 'invalid';
> ?>
> Outputs:valid
>
> If you made sure the right regex & variable arrived at your function, i'd
> be interested in this output:
> for($i = 0;$i < strlen($variable) ; $i++){
> echo $variable[$i].'='.ord($variable[$i])."\n";}
>
> --
> Rik Wasmus


It really looks like the problem is not with the regexp, but with the
rest of the code, but what is the problem???
  Réponse avec citation
 
Page generated in 0,05844 seconds with 9 queries