I want to check if an input is y or yes (inputs in lowercase) and reject everything elseWhat I have now is ^y[e]{'0,1'}[s]['0,1']$But this accepts y, ye, ys, yes. I don't want ye and ys to be accepted. 
Accept only y or yes with a one-line regular expression
regular expression
If you only accept two possibilities, you can explicitly state them:^y$\|^yes$or, depending on what you mean by without making another conditional statement, you can use:^y(es)?$The ? is equivalent to {'0,1'} and the parentheses groups the es characters together.