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

    Join Date
    Apr 2000
    Rep Power
    I'm working on a user sign-up system, and like all registration pages I require the user to add a preferred screen name, password, and email address. Of course I need to test each of the user's entries w/ regular expressions. The screen name can only have (A-Z,a-z,_) no spaces, and same goes for the password. How would I create an expression to check for that, and what would it look like? I also need to see what the code for the email address regular expression would look like. Any help would be greatly appreciated. Thanx...

    Let me know if this helps, Cryption
  2. #2
  3. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    Hi Cryption,

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    // validate username
    // W matches non-alphanumeric characters
    if(preg_match("/W/", $username))
    // print error
    // do something

    // validate email address
    if(preg_match("/^(w+.?)+@(w+.)+w+$/", $emailAddress))
    // do something
    // print error

    i'm pretty sure this will work, i haven't tested it, let me know if you have any problems and i will fire up the test bed and make it work

    [This message has been edited by RyanP (edited August 07, 2000).]

Similar Threads

  1. regular expressions
    By tdennist in forum C Programming
    Replies: 2
    Last Post: January 18th, 2004, 06:01 AM
  2. Getting parts outof text with regular expressions
    By GGK in forum PHP Development
    Replies: 8
    Last Post: August 31st, 2003, 07:31 AM
  3. using regular expressions in ErrorDocument 404 custom redirect??
    By wolfespawn in forum Apache Development
    Replies: 1
    Last Post: March 19th, 2003, 12:09 PM
  4. regular expressions in java
    By anulok in forum Java Help
    Replies: 2
    Last Post: March 5th, 2003, 09:53 AM
  5. Recursive patterns in regular expressions
    By JMM in forum Perl Programming
    Replies: 0
    Last Post: December 15th, 2001, 06:08 PM

IMN logo majestic logo threadwatch logo seochat tools logo