L
larry
I'm having trouble with a pattern match expression using
regex.
I need to have the first 4 characters as letters and the
next 2 characters as digits.
ex... PROJ12 - when trying "\D{4}\d{2}" as the
expression string.. it does not work on the .ismatch
function when i enter "proj12" into a text box.
What is the problem here?
Dim expressinvoice As New Regex("R-\d{3}\D{3,4}")
Dim expressvend As New Regex("^\D{4}\d{2}$")
Dim expressent As New Regex("\d{4}")
Dim svend As String
Dim sinv As String
Dim sent As String
sent = Trim(txtent.Text)
svend = Trim(txtvend.Text)
sinv = Trim(txtinvoice.Text)
If Not expressent.IsMatch(sent) Then
MsgBox("entity does not match format")
Exit Sub
End If
If expressvend.IsMatch(svend) Then
MsgBox("vendor is not a match")
Exit Sub
ElseIf expressinvoice.IsMatch(sinv) Then
MsgBox("invoice does not match format")
Exit Sub
End If
regex.
I need to have the first 4 characters as letters and the
next 2 characters as digits.
ex... PROJ12 - when trying "\D{4}\d{2}" as the
expression string.. it does not work on the .ismatch
function when i enter "proj12" into a text box.
What is the problem here?
Dim expressinvoice As New Regex("R-\d{3}\D{3,4}")
Dim expressvend As New Regex("^\D{4}\d{2}$")
Dim expressent As New Regex("\d{4}")
Dim svend As String
Dim sinv As String
Dim sent As String
sent = Trim(txtent.Text)
svend = Trim(txtvend.Text)
sinv = Trim(txtinvoice.Text)
If Not expressent.IsMatch(sent) Then
MsgBox("entity does not match format")
Exit Sub
End If
If expressvend.IsMatch(svend) Then
MsgBox("vendor is not a match")
Exit Sub
ElseIf expressinvoice.IsMatch(sinv) Then
MsgBox("invoice does not match format")
Exit Sub
End If