how do you make input masks for things like phone numbers and social security numbers?
Printable View
how do you make input masks for things like phone numbers and social security numbers?
you could use regular expressions http://www.regular-expressions.info/tutorial.html
Here is one for a email address \b[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}\b
Matching Vaild dates :(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])
usage example
VB Code:
Dim x as New System.Text.RegularExpressions.RegEx("\b[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}\b) Msgbox(x.Match("[email protected]")) Msgbox(x.Match("aInvaildEmail2woot.ca"))
how do i make this check a textbox? great post by the way. it took me awhile to understand the code but the website helped.
VB Code:
Dim x as New System.Text.RegularExpressions.RegEx("\b[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}\b") If x.Match(TextBox1.Text) Then Msgbox("Vaild Email!") Else Msgbox("Invaild Email!") End if
it underlines x.Match(TextBox1.Text) and says it can not be converted to boolean