#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Bremgarten, Switzerland
    Posts
    17
    Rep Power
    0
    Hi,

    I'm creating a web forum using php and mysql. The users have to register before they can post anything to the forum, thus they must choose a username. Has anybody wrote or seen a piece of code that checks if a string contains special characters? I want the username to be strictly numeric. Does anybody know how to do this with a regular expression?

    Thanks,
    Alex
  2. #2
  3. No Profile Picture
    RyanP
    Guest
    Devshed Newbie (0 - 499 posts)
    do you mean strictly alphanumeric?

    if so,

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>if(preg_match("/[^w]/", $var))
    {
    // $var not ok
    }
    else
    {
    // $var ok
    }[/code]

    [This message has been edited by RyanP (edited October 09, 2000).]

Similar Threads

  1. mod_auth_mysql & php login check ?
    By yhcmarc in forum PHP Development
    Replies: 1
    Last Post: February 16th, 2004, 01:25 AM
  2. Codepupil
    By Adachic in forum C Programming
    Replies: 3
    Last Post: February 6th, 2004, 06:50 PM
  3. array explode ( string separator, string string [, int limit])
    By beemee_freeserv in forum HTML Programming
    Replies: 4
    Last Post: February 5th, 2004, 10:56 AM
  4. mgetty+sendfax on RH9
    By ayrin in forum Linux Help
    Replies: 0
    Last Post: January 31st, 2004, 02:11 AM
  5. How to check how many users are connected in php
    By chandar in forum PHP Development
    Replies: 1
    Last Post: January 29th, 2004, 09:30 AM

IMN logo majestic logo threadwatch logo seochat tools logo