使用正则表达式进行数值检查
要求第一位为符号位后面十二位都为数字,这个正则表达式vb.net怎么写啊。
[解决办法]
^[+-][1-9]\d*$
[解决办法]
^[+-][1-9][0-9]{11}$
[解决办法]
Sub Main() Dim str As String Dim re As Text.RegularExpressions.Regex str = "-234567892234" re = New Text.RegularExpressions.Regex("^[+-][1-9][0-9]{11}$") Dim b = re.IsMatch(str) Console.Write(b.ToString()) 'true Console.ReadLine() End Sub