Character class: gray or grey
A regex exercise from Regexdrill. Solve it with a pattern box with live highlighting in your browser, checked against hidden test strings, and it is checked the moment you submit.
The task
The whole line must match. Match both spellings, gray and grey, and nothing else.
What this exercise teaches
gr[ae]y allows exactly one of a or e in the third position, so graey and groy fail.
A hint if you get stuck
Square brackets match one character from the set inside them.
Try it now, no account needed
This exercise is free. Open it on the practice page, solve it, and get instant feedback with a hint and a worked solution after two tries.
Open this exercise