Regex for string of exactly 2 characters
Matches any string that is exactly 2 character(s) long.
^.{2}$
Proof it works
| Sample | Should match | Result |
|---|---|---|
ch |
yes | pass |
chm |
no | pass |
c |
no | pass |
Matches any string that is exactly 2 character(s) long.
^.{2}$
| Sample | Should match | Result |
|---|---|---|
ch |
yes | pass |
chm |
no | pass |
c |
no | pass |