Can I have Ruby Array element with regex in it?

I want to have an array with case insensitive strings. For example I am planning to assign an array -> arr = ["yes", "Yes", "YEs", "YES"]. In the example since it’s 3-letter word it was easier but how can I do it for a long string?
I tried arr = [ /^(yes)$/i] but I don’t know how to get the array of elements from this.

Any direction on this is really appreciated. Thank you.

#grep method, it can help you.
arr = [“yes”, “no”, “Yes”, “No”, “YEs”, “YES”, “NO”]
puts arr.grep( /^(yes)$/i )

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs