in reply to Code review: validation regexes

I don't think your regexes are right. Assuming that the 'fullname' and 'mother' check names, I wonder why you allow names to contain underscores and digits, but don't allow them to start with an accented letter? Also, the publisher of the Camel and the Lama wouldn't pass the test. Furthermore, the regex for email addresses is just plain wrong. It allows illegal addresses (say foo@...9), but worse, it will reject legal addresses, like $perl$@abigail.nl.

I don't know when you are adding usernames to the system, but you have a problem. You reject usernames that are already in use, but you aren't checking the queue. Say, foo isn't taken yet, dozens of people could submit foo, until the first foo gets added to the system. What will you do with the others, who thought their submission was fine?

Abigail

Replies are listed 'Best First'.
Re: Re: Code review: validation regexes
by Anonymous Monk on Jul 08, 2003 at 11:52 UTC
    Hi there, what would you suggest for the regexes? I am not very good at them!

    The second script picks up the files every 5 minutes, and will send out an e-mail if the username has already been taken. However, if there is a way to check for these duplicates, then please show me.

    Is there an easier way of writing this script? I need users to be added to the system via a site (that has restricted access), but am worried about the security of the whole thing, and that is why i have opted to do this the 'cron' way.
      Hi there, what would you suggest for the regexes?

      That's not the right question to ask. That's like responding to someone saying I don't think granite is the right material to make lifesavers from with what kind of stone would you suggest?

      For email validation, I would not use a regexp. RFC(2)822 is authorative. I'd use a module that follows the specs from the RFC.

      As for names, I don't think there's a standard. But if you're going to accept digits in names, I would want accented letters and ' as well.

      Abigail