Regex for string of exactly 2 characters

Matches any string that is exactly 2 character(s) long.

^.{2}$

Proof it works

3/3 sample tests passed · compiles: true

SampleShould matchResult
ch yes pass
chm no pass
c no pass

Try your own input

Related patterns