473,326 Members | 2,148 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

validate email domain in object string

11
Hello,
I am trying to validate the suffix of an email address for a string entered into a form to ensure it contains the correct domain. Some of the code i am currently using looks like this for blank entries

if email="" then
response.redirect "STS_form.asp?msg=Please enter your EMAIL!" & querystr
end if

but i want to make sure that the email string contains the text "@wellsfargo.com" and if not then redirect back to the form page.

So if i were to enter "abc@yahoo.com" i would be redirected back to the form to enter a valid email address. If i entered "abc@wellsfargo.com" then the process would continue to the next if statement.

I have tried to use the search and match statements with no avail. please help!

If you need to see more of my code, please let me know.

Thanks,
Apr 15 '09 #1
2 2442
dmjpro
2,476 2GB
use regular expression.
Expand|Select|Wrap|Line Numbers
  1. var domain_pattern = /@wellsfargo.com$/;
  2. var email_id = 'your email id';
  3. alert(domain_pattern.test(email_id));
  4.  
Apr 15 '09 #2
dmjpro
2,476 2GB
@dmjpro
You can also do it by using "String.indexOf". Actually there should be a function like "String.endsWith" and "String.startsWith".
Here you can write own "String.endsWith" function like ..

Expand|Select|Wrap|Line Numbers
  1. String.prototype.endsWith = function(str){
  2.  return this.indexOf(str)==this.length-str.length;
  3. }
  4.  
Apr 17 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Paul Steele | last post by:
I'm writing a C# program that needs to validate an Active Directory username/password? The program will be running on a workstation that is not part of the domain. It doesn't have to do anything...
12
by: Dag Sunde | last post by:
My understanding of regular expressions is rudimentary, at best. I have this RegExp to to a very simple validation of an email-address, but it turns out that it refuses to accept mail-addresses...
2
by: Steffen Balslev | last post by:
I tried to find a way to validate user credentials using C#, searching google and lots of other news and kb sites left me without a solution. You can use a SSPI but it's that easy to implement so...
2
by: martin | last post by:
Hi, I would like to validate an email address from .net. Now before you scream regular expression I would like something a bit better than this. I would like to validate the domain, and maybe...
3
by: Martin | last post by:
Hi, I am implemeting a form in asp.net. The form is quite large and the validation is reasonably complex, so I have decieded to implement my own validation rather than use any custon...
11
by: Brian Henry | last post by:
I have a domain cluster with AD running, and I want to lookup a users email address (exchange 2000 server is integrated with the AD system) so i can email the user based on their user name. does...
5
by: Ryan | last post by:
HELLO I am using the following MICROSOFT SUGGESTED (somewhere on msdn) regular expression to validate email addresses however I understand that the RFP allows for "+" symbols in the email address...
0
by: comp.lang.php | last post by:
I wrote a method that should check if an email address is valid. In another method I've already checked to see if $_POST exists and is well-formed, so those checks are not necessary in this scope....
23
by: codefire | last post by:
Hi, I am trying to get a regexp to validate email addresses but can't get it quite right. The problem is I can't quite find the regexp to deal with ignoring the case james..kirk@fred.com, which...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.