About regular expressions.
(y|yes|yes|ok|ok)
I only want it to be true when only is entered.
I don't want the year to be true.
Currently, we are looking to see if any of the above words are included in the message.
If you enter a spelling with y, it will react.
I don't want to react to this.
What should I do?
//measege is a variable that contains data from user input.
constyesExp=/(y|yes|yes|yes|ok|ok)/;
clearExp.test(measege)
Add the beginning and end of the string to your search criteria
/^(y|yes|yes|ok|ok)$/
Please say
© 2024 OneMinuteCode. All rights reserved.