M Makumbi Well-Known Member Licensed User Longtime User Nov 21, 2018 #1 Code: Copy If CCode.Text = "" Or Phone.Text = "" or Email.Text = "" Then Msgbox("You Must enter Country Code and Your Phone Number","Missed data field") Return How can i check for Valid Email for the Email field and also Check the Phone Filed to make sure its characters are not Less or greater than 10 characters before inserting them into the table Please help
Code: Copy If CCode.Text = "" Or Phone.Text = "" or Email.Text = "" Then Msgbox("You Must enter Country Code and Your Phone Number","Missed data field") Return How can i check for Valid Email for the Email field and also Check the Phone Filed to make sure its characters are not Less or greater than 10 characters before inserting them into the table Please help
DonManfred Expert Licensed User Longtime User Nov 21, 2018 #2 https://www.b4x.com/android/forum/threads/validate-a-correctly-formatted-email-address.39803/ Upvote 0
sz4t4n Member Licensed User Longtime User Nov 21, 2018 #3 https://www.b4x.com/android/forum/threads/b4x-regular-expressions-regex-tutorial.7123/#content Upvote 0
Sandman Expert Licensed User Longtime User Nov 21, 2018 #4 DonManfred said: https://www.b4x.com/android/forum/threads/validate-a-correctly-formatted-email-address.39803/ Click to expand... I see this mentioned now and then, and it's a bit unfortunate that the page doesn't mention the limitations of the code snippet as it produces somewhat incorrect results. (Well, both do, as they use the same regex.) It's simple to test, just go to the Wikipedia page for email addresses and test the valid and invalid ones: https://en.wikipedia.org/wiki/Email_address#Examples. Yes, some of them are very strange, but that doesn't make them less valid, or invalid. I ran them through an online regex tool and got the result below. (For more strange examples, search the net. Here's a list I found right away.) I am fully aware that the snippet is absolutely fine for 99% of the cases, but I think it should be clarified that it's not 100% correct. I have no problem with anyone using it, as long as they understand this. In reality there is only one way to validate an email address with 100% certainty: Send a test email to the entered address, with a link for the user to click. Makumbi said: How can i check for Valid Email ... to make sure its characters are not Less or greater than 10 characters Click to expand... A valid address can be as short as 3 characters, as far as I can tell. Odds are against that you will ever encounter such an address obviously, but just picking 10 as a limit is just plain wrong. I'm sure that [email protected] would agree with me. Upvote 0
DonManfred said: https://www.b4x.com/android/forum/threads/validate-a-correctly-formatted-email-address.39803/ Click to expand... I see this mentioned now and then, and it's a bit unfortunate that the page doesn't mention the limitations of the code snippet as it produces somewhat incorrect results. (Well, both do, as they use the same regex.) It's simple to test, just go to the Wikipedia page for email addresses and test the valid and invalid ones: https://en.wikipedia.org/wiki/Email_address#Examples. Yes, some of them are very strange, but that doesn't make them less valid, or invalid. I ran them through an online regex tool and got the result below. (For more strange examples, search the net. Here's a list I found right away.) I am fully aware that the snippet is absolutely fine for 99% of the cases, but I think it should be clarified that it's not 100% correct. I have no problem with anyone using it, as long as they understand this. In reality there is only one way to validate an email address with 100% certainty: Send a test email to the entered address, with a link for the user to click. Makumbi said: How can i check for Valid Email ... to make sure its characters are not Less or greater than 10 characters Click to expand... A valid address can be as short as 3 characters, as far as I can tell. Odds are against that you will ever encounter such an address obviously, but just picking 10 as a limit is just plain wrong. I'm sure that [email protected] would agree with me.