I've been using regular expressions for a few months, but I've hit a problem I can't figure out. I need a MySQL regexp to match a string made up of a sequence of characters occurring only 0 or 1 times. For example, for characters 'a', 'b', and 'c', I want to match to 'a', 'b', 'c', 'ab', 'ac', 'ba', 'bc', 'ca', 'cb', 'abc', 'acb', 'bac', 'bca', 'cab', 'cba', and nothing else.
My problem is that I'm getting things like 'abcd' showing up because the 'abc' pattern is in there, but I want to match to an exact string, not a pattern existing somewhere in the string. I've gone thought dozens of different regular expressions and I can't get what I'm looking for. Any suggestions?