Thanks a heap, James.  That has solved it like magic
:)

Best regards,
David

--- James Keeline <[EMAIL PROTECTED]> wrote:

 
> --- David Halliday <[EMAIL PROTECTED]> wrote:
> 
> > Hi
> > 
> > I have this simple code that rejects certain
> > characters :
> > 
> >     if (ereg('([/[EMAIL PROTECTED]&*-_()|:;<>?"])', $name))
> >     {
> >             echo 'not allowed';
> >     }
> > 
> > Trouble is that it also rejects the dot or period
> (.)
> > yet the dot is not included in the class above  
> > 
> > What can be added to that criteria to make it
> *allow*
> > the dot?  Would appreciate your help.  
> > 
> > David
> 
> In a regular expression character class -- a list or
> sequence of characters
> listed in square brackets -- the dash is used for a
> range of characters if the
> character to the left of the dash has a lower ASCII
> value than the character on
> the right of the dash.  You have:
> 
>   *-_
> 
> The * is 42 decimal and the _ is 95.  In that sense,
> any capital letter would
> also "match" and be denied.
> 
> To solve this, put your dash at the end of the list
> in square brackets so it is
> treated as a literal rather than its special
> meaning.
> 
> James Keeline



        
        
                
___________________________________________________________ 
New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at 
the Yahoo! Mail Championships. Plus: play games and win prizes. 
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk 

Reply via email to