我在认证应用程序上工作,其中用户必须输入银行支票号码MICR号码。我希望提醒用户,当他没有以适当的方式输入它。支票和MICR验证是否有正则表达式?有没有办法做到这一点。
提前谢谢。
发布于 2020-12-04 17:32:11
可以应用下面的正则表达式。
//Make sure the first digit does not start with zero
string pattern = @"^[1-9][0-9]{8}$"; //if always 9 digits are required
//pattern = @"^[1-9][0-9]{5,8}$"; //if always 6-9 digits are required
string inputValue = "560240004";
if (Regex.IsMatch(inputValue, pattern))
{
Debug.Print($"Input text {inputValue} matches.");
}
else
{
Debug.Print($"Input text {inputValue} does not match.");
}https://stackoverflow.com/questions/65139884
复制相似问题