#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    77
    Rep Power
    15
    Hi there,

    Is there any special way that you can use the eregi/ereg expression to find out if an entered value contains any non-numeric value? Currently I am working out if it contains any alpha values. But I don't know how to make sure it doesn't have all the other non-numeric values such as ?, !, #, $, etc etc.

    Now I know people will say that the best way is to make sure it has numeric values rather than not having alpha but I have one catch... the value can be between 1 and 3 integers. So if I enter 1 numeric, and 1 alpha, I find that it still returns true (using if (eregi("([0-9]{1})", $empid)))

    Any thoughts would be much appreciated!

    Thanks.

    Dave
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    77
    Rep Power
    15
    nevermind everyone,

    I found that I can do it using this:

    if (eregi("([^0-9])", $split_amt2))
    {
    error_message;
    }

    Dave
  4. #3
  5. No Profile Picture
    Carpe Diem
    Guest
    Devshed Newbie (0 - 499 posts)
    What about
    eregi("([0-9][0-9][0-9]

    I know there is an easier way but its 1:30am



    ------------------

    Regards
    Darren
    --
    http://www.php4hosting.com/ $
    http://www.php4hosting.co.uk/ £
    PHP/MySQL Enabled Hosting/Dedicated Servers

Similar Threads

  1. validating css stylesheet with w3org
    By tenaka in forum CSS Help
    Replies: 5
    Last Post: December 1st, 2003, 05:16 PM
  2. validating email address
    By delta in forum HTML Programming
    Replies: 0
    Last Post: September 25th, 2002, 10:07 AM
  3. form validating suggestion?
    By michelle in forum PHP Development
    Replies: 1
    Last Post: August 5th, 2002, 11:00 AM
  4. validating xhtml
    By Pupeno in forum HTML Programming
    Replies: 6
    Last Post: April 4th, 2002, 12:54 PM
  5. Errors validating XHTML page
    By slowhandz in forum PHP Development
    Replies: 3
    Last Post: March 11th, 2002, 12:35 PM

IMN logo majestic logo threadwatch logo seochat tools logo