m0tSiE
asked on
Check textbox contians "DWD" followed by 5 HEX characters?
Hi,
I'm using the below code to check my textbox has a value of "DWD" and 5 hex characters, e.g. DWD00A0A. It doesn't seem to work with the (5) after the HEX part of the validation, although it does work without the (5) in there, although it means users can enter more than 5 HEX characters.
can anyone see why this is not working?
Thanks,
Paul.
I'm using the below code to check my textbox has a value of "DWD" and 5 hex characters, e.g. DWD00A0A. It doesn't seem to work with the (5) after the HEX part of the validation, although it does work without the (5) in there, although it means users can enter more than 5 HEX characters.
can anyone see why this is not working?
Thanks,
Paul.
If Not Regex.IsMatch(Respond_DWD.Text, "^[D]{1}[W]{1}[D]{1}[A-Fa-f0-9](5)$") Then
MessageBox.Show("Please enter users workstation id in the correct format (E.G. DWD1A2B3)." & vbNewLine & vbNewLine & "E.G. DWD00A0A")
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Cheers! :D
Note also the your "[D]{1}[W]{1}[D]{1}" is more easily readable as "DWD"...
glad to be of some help :)
glad to be of some help :)
ASKER
Cheers.