'/hi|hello/'
"black and white".contains('/black|gray|white/')
// matches black
"black and white".contains('/white|gray|black/')
// matches black. Even though white is the first
// alternative in the string, black matches
// earlier in the string.
"Bye!".contains('/b|by|bye|bye!/i')
// matches b
"Bye!".contains('/bye!|bye|by|b/i')
// matches bye!
The last example suggests that if some of the alternatives are prefixes of the others, they put the longest alternatives first. Otherwise, they will never match.
In some way, you can think of character classes as character alternations. So '/[aeiou]/' behaves like '/a|e|i|o|u/'.