I have to do some pattern matching for text in a textbox. I was doing it in postback event of server in C#.
My regex is as follows :
public bool ValidatePassword(string temp)
{
bool isMatch = false;
passwd = passwd.Trim();
isMatch = Regex.IsMatch(temp,
@"^ # Start of string
(?=.*\p{Lu}) # Assert at least one uppercase letter
(?=.*\p{Ll}) # Assert at least one lowercase letter
(?=.*\d) # Assert at least one digit
(?=.*[^\p{L}\d]) # Assert at least one other character
.{8,13} # Match at least 8 characters and maximum of 13 characters
$ # End of string",
RegexOptions.IgnorePatternWhitespace);
return isMatch;
}
I want to move this to Javascript so that I do the matching on client side. Can someone help me moving this function to Javascript?
Something like: