PackUtils/RegexUtility.cs
/// <summary>
/// Return Regex for Alpha Numeric sensitive
/// </summary>
/// <returns></returns>
Return Regex for Alpha Numeric sensitive
Return Regex for Alpha Numeric sensitive
public static string GetPasswordRegex(int min, int max, bool requiresSpecialChar, bool requiresNumericChar, bool requiresLowerChar, bool requiresUpperChar)
        {
            var expression = "";
            var specialChars = "\\\"\\\'!@#$%¨&*()_\\-+=§¬¢£¹²³\\\\\\/|,.<>;:?°ºª\\[\\]{}~^´`";
            expression += (requiresLowerChar)
                ? "(?=.*[a-z])"
                : "([a-z]?)";
            expression += (requiresUpperChar)
                ? "(?=.*[A-Z])"
                : "([A-Z]?)";
            expression += (requiresNumericChar)
                ? "(?=.*[0-9])"
                : "([0-9]?)";
            expression += (requiresSpecialChar)
                ? "(?=.*[" + specialChars + "])"
                : "([" + specialChars + "]?)";
            return "^{exp}.{{min},{max}}$"
                    .Replace("{exp}", expression)
                    .Replace("{min}", min.ToString())
                    .Replace("{max}", max.ToString());
        }
public static string GetPasswordRegex ( int min , int max , bool requiresSpecialChar , bool requiresNumericChar , bool requiresLowerChar , bool requiresUpperChar ) { var expression = " " ; var specialChars = " \\ \" \\ \' \- ,. <> ;: `" expression += ( requiresLowerChar ) ? " " : " " ; expression += ( requiresUpperChar ) ? " " : " " ; expression += ( requiresNumericChar ) ? " " : " " ; expression += ( requiresSpecialChar ) ? " " + specialChars + " " : " " + specialChars + " " ; return " " . Replace ( " " , expression ) . Replace ( " " , min . ToString ( ) ) . Replace ( " " , max . ToString ( ) ) ; }
Return Regex for Alpha Numeric sensitive
Return Regex for Alpha Numeric sensitive
None
min
int
max
int
requiresSpecialChar
bool
requiresNumericChar
bool
requiresLowerChar
bool
requiresUpperChar
bool