判断日期格式的正则表达式


Imports VBScript_RegExp_55

'正则表达式()
        Dim b As Boolean
        Dim res As New RegExp
        res.Pattern = "\d{4}\-(0?[1-9]|[1][012])\-(0?[1-9]|[12][0-9]|3[01])"
        b = res.Test(tbBirthday.Text)
        If b = False Then
            MsgBox("birthday error(xxxx-xx-xx)", MsgBoxStyle.Exclamation + MsgBoxStyle.MsgBoxSetForeground, "警告")
            Return False
        End If

 

你可能感兴趣的:(VB.net)