"The quickest way to advance around here is to get some project management experience under your belt!" was the advice Andrew's boss handed out along with an assignment to work with the offshore group.

The task was meant to be a super simple project to get his feet wet working with the remote team - add validation to the email address field on a vendor profile screen used by the purchasing group.

In following with agreed upon standards, Andrew completed his functional design document detailing valid email address requirements - the address must contain an "@" symbol, must include a domain name, alphanumeric characters only, and punctuation like underscores, hyphens, periods are all OK - and sent it along with other supporting documents off to the remote dev team in Kerbleckistan. A few days later, Andrew received a message saying that the changes were ready for testing in the sandbox environment at his convenience.

The developer also noted "I think that you maybe you forgot to include all of valid email requirements in your spec. I included some extra validations. You're welcome! :-)"

Andrew was thrilled and impressed that the dev had gone above and beyond (especially with it being his first time working with them). Coming from a coding background, Andrew couldn't resist taking a peek at the code behind the validation, but after seeing the fruits of the other developer's labor, he wished he hadn't.

Thank goodness he has his own coding experience to fall back upon.

Public Function LibValidateEmail(ByVal strEmail As String) As String
        '
        '   Validate email address - if valid returns "".
        '
        Dim strReturn As String = ""

        If Len(strEmail) < 7 Then
            strReturn = "Please fill in full email address"
            GoTo ExitHandler
        End If
        If InStr(strEmail, "@") = 0 Then
            strReturn = "Please fill in valid email address including the '@' character"
            GoTo ExitHandler
        End If
        If InStr(strEmail, "@@") > 0 Then
            strReturn = "Email address cannot contain '@@'"
            GoTo ExitHandler
        End If
        If Left(strEmail, 1) = "@" Then
            strReturn = "Email address cannot start with '@'"
            GoTo ExitHandler
        End If
        If Right(strEmail, 1) = "@" Then
            strReturn = "Email address cannot end with '@'"
            GoTo ExitHandler
        End If
        If InStr(strEmail, ".@") > 0 Then
            strReturn = "Email address cannot contain '.@'"
            GoTo ExitHandler
        End If
        If InStr(strEmail, "@.") > 0 Then
            strReturn = "Email address cannot contain '@.'"
            GoTo ExitHandler
        End If

        If InStr(strEmail, "..") > 0 Then
            strReturn = "Email address cannot contain '..'"
            GoTo ExitHandler
        End If
        If Left(strEmail, 1) = "." Then
            strReturn = "Email address cannot start with '.'"
            GoTo ExitHandler
        End If
        If Right(strEmail, 1) = "." Then
            strReturn = "Email address cannot end with '.'"
            GoTo ExitHandler
        End If

        If InStr(strEmail, Chr(32)) > 0 Then
            strReturn = "Email address cannot contain space"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(31)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(30)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(29)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(28)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(27)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(26)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(25)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(24)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(23)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(22)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(21)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(20)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(19)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(18)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(17)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(16)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(15)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(14)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(13)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(12)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(11)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(10)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(9)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(8)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(7)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(6)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(5)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(4)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(3)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(2)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(1)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If

        If InStr(1, strEmail, "!") > 0 Then
            strReturn = "Email address cannot contain '!'"
            GoTo ExitHandler
        End If
        If InStr(strEmail, Chr(34)) > 0 Then
            strReturn = "Email address cannot contain " & Chr(34)
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, "#") > 0 Then
            strReturn = "Email address cannot contain '#'"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, "$") > 0 Then
            strReturn = "Email address cannot contain '$'"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, "%") > 0 Then
            strReturn = "Email address cannot contain '%'"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, "&") > 0 Then
            strReturn = "Email address cannot contain '&'"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, "(") > 0 Then
            strReturn = "Email address cannot contain '('"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, ")") > 0 Then
            strReturn = "Email address cannot contain ')'"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, "*") > 0 Then
            strReturn = "Email address cannot contain '*'"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, "+") > 0 Then
            strReturn = "Email address cannot contain '+'"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, ",") > 0 Then
            strReturn = "Email address cannot contain ','"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, "/") > 0 Then
            strReturn = "Email address cannot contain '/'"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, ":") > 0 Then
            strReturn = "Email address cannot contain ':'"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, ";") > 0 Then
            strReturn = "Email address cannot contain ';'"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, "<") > 0 Then
            strReturn = "Email address cannot contain '<'"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, "=") > 0 Then
            strReturn = "Email address cannot contain '='"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, ">") > 0 Then
            strReturn = "Email address cannot contain '>'"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, "?") > 0 Then
            strReturn = "Email address cannot contain '?'"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, "[") > 0 Then
            strReturn = "Email address cannot contain '['"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, "\") > 0 Then
            strReturn = "Email address cannot contain '\'"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, "]") > 0 Then
            strReturn = "Email address cannot contain ']'"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, "^") > 0 Then
            strReturn = "Email address cannot contain '^'"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, "`") > 0 Then
            strReturn = "Email address cannot contain '`'"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, "{") > 0 Then
            strReturn = "Email address cannot contain '{'"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, "|") > 0 Then
            strReturn = "Email address cannot contain '|'"
            GoTo ExitHandler
        End If
        If InStr(1, strEmail, "}") > 0 Then
            strReturn = "Email address cannot contain '}'"
            GoTo ExitHandler
        End If

        If InStr(strEmail, Chr(127)) > 0 Then
            strReturn = "Email address cannot contain invalid characters"
            GoTo ExitHandler
        End If

ExitHandler:
        LibValidateEmail = strReturn

    End Function
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!