Re: [02/03] Regex Problem
Works fine for me, for a slight modification, you can add a beginning "^" and an ending "$" to the pattern if your string is supposed to contain the whole match and nothing else, that would tell it to match on the entire string, and if the entire string doesnt match, then it should return false. Below is a modified example of the pattern I am talking about, although both worked fine for me.
VB Code:
Dim strIMEIFormat As String = "^\d{6}-\d{2}-\d{6}-\d{1}$"
Dim strIMEI As String = "123456-12-123456-1"
MessageBox.Show(System.Text.RegularExpressions.Regex.IsMatch(strIMEI, strIMEIFormat).ToString)
Does your string you are wanting to match on always contain just a pattern you are wanting to match? Or other things as well? If this number can be anywhere inside of a long string of text, then you don't want the beginning and end characters that I added.
One last thing... when you are testing this and saying that sometimes it returns false, are you sure that the string you are giving it should return true?