I'm working towards a solution that requires me to write a web service that validates if a string is a valid government or military email address.
This is only going to validate the format of the text entered and not that it actually exists. From that end, I have figured out that I can use regular expressions to do so. However, it seems like I'm having difficulty wrapping my head around setting up the regular expression.
The following code snippit is an example that I've found
<%@ language="C#" %> <form id="form1" runat="server"> <asp:TextBox ID="txtName" runat="server"/> <asp:Button ID="btnSubmit" runat="server" Text="Submit" /> <asp:RegularExpressionValidator ID="regexpName" runat="server" ErrorMessage="This expression does not validate." ControlToValidate="txtName" ValidationExpression="^[a-zA-Z'.\s]{1,40}$" /> </form>
I see where it says "ValidationExpression" and I've seen some other examples but I just cant figure out how to change the argument of that command to validate for say ValidationExpression="@mail.mil" for example... so that I can verify the formatting of the email address?