Friday, April 25, 2014

Is valid Computer Name?

Function IsValidComputerName ( OSDComputerName )

    Dim regEx
    Set regEx = New RegExp
    regEx.Pattern = "[^a-zA-Z0-9\-\_]"   'Strict Subset
    ' regEx.Pattern = "[^a-zA-Z0-9\!\@\#\$\%\^\&\'\)\(\.\-\_\{\}\~ ]" ' SetComputerName compliant
    IsValidComputerName     = not regEx.Test ( OSDComputerName ) and len(OSDComputerName) <= 15

End function

No comments:

Post a Comment