Skip to content

Commit 2130cf8

Browse files
authored
Update README.md
1 parent fb5e57b commit 2130cf8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,15 @@ The ```Validate``` method runs through all the set checks and returns ```true```
142142
bool isValid = validator.Validate(password);
143143
```
144144

145-
<i>Failed checks</i>
145+
<i>Partial criteria matching</i>
146+
Partial criteria matching is a feature that allows a password to be validated even if only a subset of the checks pass. For example, if you add the check for letters, the check for numbers, and the check for upper and lower case, then you can pass a value of 2 to the validator indicating that the password is only required to pass two of these three checks. A password with letters and numbers, but no upper case is then still valid. You can also provide a value between 0 and 1 representing the % of checks that must pass.
147+
148+
```C#
149+
bool isValid = validator.Validate(password, 2); // Two tests must pass for the password to be valid.
150+
bool isValid = validator.Validate(password, 0.5); // 50% of the tests must pass for the password to be valid.
151+
```
152+
153+
<i>Failed checks</i>
146154
One can iterate over the checks that failed by doing the following:
147155
```C#
148156
foreach (Check failedCheck in validator.FailedChecks)
@@ -151,7 +159,7 @@ foreach (Check failedCheck in validator.FailedChecks)
151159
}
152160
```
153161

154-
<i>Passed checks</i>
162+
<i>Passed checks</i>
155163
One can iterate over the checks that passed by doing the following:
156164
```C#
157165
foreach (Check passedCheck in validator.PassedChecks)

0 commit comments

Comments
 (0)