Need help building a VBScript regex that checks for a valid computer name and returns only invalid characters. String can contain numbers, upper and lower case letters, and (-) sign only. It can’t start or end with (-) and cannot be only numbers.
Valid (Returns no match):
computer
Computer8
8Computer
Com8puter
Com-Puter
Computer-123
Invalid (Returns a match to invalid characters):
123
-computer
computer-
com*puter
PC&123
I ended up switching the valid and invalid returns. I also ended up using two different RegEx strings. The first is:
This doesn’t allow the (-) at the beginning or end and requires all numbers, letters, or (-). It also requires a string of at least two characters.
The second is:
This makes sure there is at least one letter included.