I am looking for a simple ruby reg ex for matching one and only one of three characters. for example:
“a” or “b” or “c” but not “ab”, “ac”, etc.
The ones I have tried /[abc]/ or /a|b|c/ do not work because they also match “ab”, “ac”, etc. according to rubular.com. I also tried playing with ^ and $ placement but it did not work.
I am new to ruby and must be missing something simple. Please help. Thank you!
But why not just use
==if you specifically need to match a single character? If you need to do something with the character you could roll that all up and skip regex altogether.