You want to learn about character classes:
[abc] matches a character that is either an a, a b or a c.
[^abc] matches any character that is neither an a, a b nor a c.
Together with quantifiers and start- and end-of-string anchors, you’re all set.
^[^X]*$ matches a string of any length that doesn’t contain X.
^.*X.*$ matches any string that contains at least one X.
^[^X]*X[^X]*$ matches a string of any length that contains exactly one X.
1
solved Need two regular expressions