The following code can be used for the above purpose
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ControlToValidate="TextBox1"
ErrorMessage="The text must be in the format A####";
ValidationExpression="[A-Z]{1}[0-9]{4}">
</asp:RegularExpressionValidator>