Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I have a textbox in which i have to enter 20 character value with last character must be F, Please provide me regular expression for this.

Thanks in advance.
Posted

1 solution

use js
C#
function ValidTxt(txt)
    {
        //alert(txt.value);
        var reg = new RegExp("[A-Z][0-9]{19}[F]");
        if(txt.value != '')
        {
            if(!reg.test(txt.value) || txt.value.length != 20)
            {
                alert('Not in correct format.');
                txt.focus();
                return false;
            }
        }
        return true;
    }
 
Share this answer
 
v2
Comments
Manas Bhardwaj 18-Jun-12 7:06am    
correct +5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900