如何使用Asterisk C#Regex允许的数字 [英] How Do I Numbers Allowed With Asterisk C# Regex
本文介绍了如何使用Asterisk C#Regex允许的数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的朋友们,
我试图使用正则表达式阻止数字值输入形式txtbox
i需要允许的数字带*
ex - 444 - 不允许
* 444 * - 允许
任何人都可以帮助我。
这是我的代码。我已经尝试但是它没有工作
Dear friends,
i'm trying to block numeric value input form txtbox using regular expression
i need allowed numbers with *
ex - 444 - not allowed
*444* - allowed
can anyone help me.
here is my code. i have tried but it's not working
else if (!Regex.IsMatch(txtLunchinput.Text, ".*[a-zA-Z]+.*"))
{
MessageBox.Show("Wrong!");
return;
}
推荐答案
请看我对这个问题的评论。
一些提示: 1)*应该逃脱; 2)dot(。)表示任何角色,不确定这是你想要的。
我认为这对你来说已经足够了。
-SA
Please see my comment to the question.
Some hints for you: 1) * should be escaped; 2) dot (.) means "any character", not sure this is what you want.
I think this would be enough for you.
—SA
这是微不足道的。通过学习 30分钟正则表达式教程来找到答案[ ^ ]
This is trivial. Find your answer by learning from The 30 Minute Regex Tutorial[^]
这篇关于如何使用Asterisk C#Regex允许的数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文