Re: Check for special character

From: Alan Connor (zzzzzz_at_xxx.yyy)
Date: 10/28/04

  • Next message: Petterson Mikael: "generate HTML"
    Date: Thu, 28 Oct 2004 08:21:39 GMT
    
    

    On Thu, 28 Oct 2004 15:04:00 +0800, Smith <someone@microsoft.com>
    wrote:

    > hi, My script accept user input into a variable USRIP. I only
    > want input to have (aA-zZ or 0-9). How do I check that the
    > variable USRIP doesn't has special character (e.g #$* @ etc
    > etc) and only has aA-zZ and 0-9?
    >
    > Thanks and regards
    >
    >

    Here's one way, Smith:

    (assuming bash or the like)

    echo $USRIP | if grep '[^a-zA-Z0-9]' ; then do <whatever>
    else <whatever>; fi

    AC


  • Next message: Petterson Mikael: "generate HTML"