ereg regexp problem

ereg regexp problem

am 30.09.2007 14:10:53 von rallykarro

Hi,

I have a problem of matching a dash(-) in the code beolow.
Why does not the below work when matching a dash(-) but all other
signs is correctly matched when trying?

$res =3D ereg("^[a-zA-Z\.\-\,\/\=C5\=E5\Ä\ä\Ö\ö\Ü\ü\ß\= E9\=E6=
\=F8\=C6\=D8 ]+$", "-");

I am running PHP Version 5.0.5 on windows.

thanks,

//Karolina

Re: ereg regexp problem

am 30.09.2007 17:52:42 von Shion

rallykarro@hotmail.com wrote:
> Hi,
>
> I have a problem of matching a dash(-) in the code beolow.
> Why does not the below work when matching a dash(-) but all other
> signs is correctly matched when trying?
>
> $res = ereg("^[a-zA-Z\.\-\,\/\Å\å\Ä\ä\Ö\ö\Ü\ü\ß\é\æ\ø\Æ\Ø ]+$", "-");
>
> I am running PHP Version 5.0.5 on windows.

$res = ereg("^[a-zA-Z\.\,\/ÅåÄäÖöÜüßéæøÆØ -]+$", "-");

The '-' should be last if it's to compared to, anywhere else it will be used
to mark a range.

--

//Aho