Gossamer Forum
Home : Products : DBMan : Customization :

Correct format for user input e-mail

Quote Reply
Correct format for user input e-mail
urh ... managed to delete what I had written... surely I'm going crazy (as I wrote in previous). If someone has answered this before I'm happy to be redirected to the correct post, but I couldn't find anything in my searches.

I'm having trouble with people inputting strange things in my e-mail fields, even if I've tried to define a regular expression they must match:

My field definition:

Code:
'Email' => [59, 'alpha', 0, 80, 1, '', '.+@.+\..+'],[/code]

Still people are able to pass through with eg:


john@doe.org (and doe@john.org)


That is they input those two e-mails - with the parenthesis. Great trouble later on when I try to send e-mail confirmation and subscribe them to mailinglists.

any clues?
---
Kjell Knudsen
http://www.icbl.org
Quote Reply
Re: [kjellkk] Correct format for user input e-mail In reply to
Not sure I understand are they able to enter the actual parenthesis within the email field?

It should work to just use:

'.+@.+..+'

Taken from the FAQ noted below under "Syntax" category:

For those interested in an interpretation,

.+ = one or more characters
\@ = the @ sign
.+ = one or more characters
\. = a dot
.+ = one or more characters

This will require that all entries in the field will be in the format of: something@something.something

Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/
Quote Reply
Re: [LoisC] Correct format for user input e-mail In reply to
It seems that as soon as I put a @ symbol and a dot somewhere after it then it will accept any other character.

Ie then I can have spaces, commas, parenthesis +++

Does .+ designate any character at all? What would one use to say that it should only allow numbers, letters, hyphen, dot and underscore?

thanks,

-kjell
---
Kjell Knudsen
http://www.icbl.org
Quote Reply
Re: [kjellkk] Correct format for user input e-mail In reply to
I did a quick search in the GT's Perl Programming forum and found this ...http://www.gossamer-threads.com/...i?post=242812#242812

I searched for "verify email" and got lots of results, you can give it a try if you don't like the link "I have selected for your dining pleasure". Smile

This is a method other than using the config file valid expression (ie requires some coding).

When I read reply from LoisC I thought there were some problems, mostly after the last "dot" anything could be entered, when in fact there is a limited number of valid domain types, but I am not an expert in regex or domain names for that matter, they seem to add more types all the time!

You might consider asking the user to enter the email address twice, or even have them split the address into 3 parts for you, then let the config file evaluate the parts one at a time.
Quote Reply
Re: [joematt] Correct format for user input e-mail In reply to
Thanks very much for helping me search Joe!

Doesn't seem that I need to do any extra coding either. I put:

Code:
'Email' => [59, 'alpha', 0, 80, 1, '', '[0-9a-z]([-_.+]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,}$'],


And that works fine. (so far so good :-) )

Dividing up the field would have complicated things a bit further on - ie to "stitch" the input back into one field again plus they'd have to type in more than one field.

again - thanks very much



-kjell
---
Kjell Knudsen
http://www.icbl.org