Question: ```
<asp:Label ID="lblDriving" runat="server" CssClass="lblDriving">Driving (y/n)</asp:Label>
<asp:TextBox ID="tbDriving" runat="server" CssClass="tbDriving"></asp:TextBox> 
<asp:RequiredFieldValidator ID="rfvDriving" runat="server" CssClass="errorAsterik" ErrorMessage="Please enter y or n in lowercase only" ControlToValidate="tbDriving">*</asp:RequiredFieldValidator>
<asp:RangeValidator ID="rvDriving" runat="server" CssClass="errorAsterik" ErrorMessage="Please enter n or y in lower case" ControlToValidate="tbDriving" MinimumValue="n" MaximumValue="y">*</asp:RangeValidator>

```

How do i validate it so the user can enter a lowercase y/n or uppercase Y/N using the ASP.NET Validators?

Answer: 
You could use a RegularExpressionValidator:

```
<asp:RegularExpressionValidator ID="rvDriving" runat="server" 
   CssClass="errorAsterik" ErrorMessage="Please enter n or y" 
   ControlToValidate="tbDriving" 
   ValidationExpression="[yYnN]">*</asp:RegularExpressionValidator>

```
You will have to use a [`CustomValidator`](http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.customvalidator.aspx) because the `CompareValidator` with `Type=String` compares case-sensitive.

```
<asp:CustomValidator id="ValidDriving"
       ControlToValidate="tbDriving"
       ErrorMessage="Enter y/Y or n/N"
       OnServerValidate="ValidateDriving"
       ClientValidationFunction="ValidateDriving_JS" 
       runat="server"/>

```

server-validate:

```
protected void ValidateDriving(object source, ServerValidateEventArgs args)
{
    args.IsValid = StringComparer.OrdinalIgnoreCase.Equals("y", args.Value) ||
                   StringComparer.OrdinalIgnoreCase.Equals("n", args.Value);
}

```

If you also want to provide a clientside-validation function:

```
function ValidateDriving_JS(sender, args){
    var upperVal = args.Value.toUpperCase();
    args.IsValid = upperVal  == "Y" || upperVal == "N";
    return;      
}

```