Does anybody knows what the regular expresion pattern for a variable string (includes '_' but does not starts with '_' and does not include ?/#@!%^&* and spaces).
Thanks
Printable View
Does anybody knows what the regular expresion pattern for a variable string (includes '_' but does not starts with '_' and does not include ?/#@!%^&* and spaces).
Thanks
Code:Private Sub Text1_KeyPress(KeyAscii As Integer)
'allow only alpha and numerical and _ and no other keys
If KeyAscii = 95 Or KeyAscii >= 65 And _
KeyAscii <= 90 Or KeyAscii >= 97 And KeyAscii <= 122 _
Or KeyAscii >= 48 And KeyAscii <= 57 Then
KeyAscii = KeyAscii
Else
KeyAscii = 0
End If
End Sub