|
Posted by iuz on 12/31/05 16:21
Willem-Jan wrote:
> Hi all,
>
> I have problems checking a string with a regular expression. I use:
>
> ereg("[^A-Za-z0-9-]", $string)
>
> to allow characters, digits and -. What do I have to add to allow a
> space, a comma and ;?
>
> Thanx,
> WJ
in order to check if a string is made only by chars, digits, '-', ';' and
','.. IMHO the correct regex should be..
'/^[a-zA-Z0-9\-;,]+$/'
used with preg_match() function that is often a faster alternative to
ereg()..
--
www.iuz-lab.info
Navigation:
[Reply to this message]
|