20个字符的字母数字值的正则表达式,后一个F [英] regular expression for 20 character alphanumeric value with F last character
本文介绍了20个字符的字母数字值的正则表达式,后一个F的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我有一个文本框,其中我必须输入20个字符,最后一个字符必须为F,请为此提供正则表达式.
在此先感谢您.
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.
推荐答案
使用js
use js
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;
}
这篇关于20个字符的字母数字值的正则表达式,后一个F的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文