Regex that matches the single given character. E.g. singleChar('a') is equivalent to /^a$/. Meta characters like "$", ".", etc don't need to be escaped, i.e. singleChar('.') will match "." literally and not any-single-character.
singleChar('a')
/^a$/
singleChar('.')
if char is not exactly one character.
char
Regex that matches the single given character. E.g.
singleChar('a')
is equivalent to/^a$/
. Meta characters like "$", ".", etc don't need to be escaped, i.e.singleChar('.')
will match "." literally and not any-single-character.