Hi,

        That might actually be a good solution for another item I'm working with.
Thanks for the tip.

-Dan Joseph

> -----Original Message-----
> From: Jay Blanchard [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 01, 2003 10:10 AM
> To: Dan Joseph; [EMAIL PROTECTED]
> Subject: RE: [PHP] Regular Expression
>
>
> [snip]
>       That would have been my first choice also, however, with the #
> and - being
> legal, things like ctype_alnum and others don't work out.
> [/snip]
>
> Here is an example of something that I did before;
>
> $alphachar = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
> $ld1alpha = strspn($ld1, $alphachar);
> if(strlen($ld1) != $ld1alpha){
>       $err[$i] = "The LD1 may only contain alpha characters.<br>\n";
>       $i++;
> }
>
> int strspn ( string str1, string str2) - Returns the length of the
> initial segment of str1 which consists entirely of characters in str2.
> You could add - and # to $alphachar
> Now, in this case $ld1aplpha would be the same length as the string
> length of the input field where the characters are contained in
> $alphachar. This is used as one of the steps in a
> verification/validation procedure on a large internal form.
>
> Just another solution to the problem
>
> HTH!
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to